Bug 53104 - Forms page template with view model is broken
Summary: Forms page template with view model is broken
Status: RESOLVED DUPLICATE of bug 52985
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Templates ()
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: James Montemagno [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2017-03-07 02:56 UTC by Bret Johnson [MSFT]
Modified: 2017-03-07 16:30 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED DUPLICATE of bug 52985

Description Bret Johnson [MSFT] 2017-03-07 02:56:38 UTC
Note that I'm using VS 2017 (RTW version).

Create a new Xamarin app, then in the Solution Explorer do Add / New Item and pick "Forms Content Page Xaml", the one with description "Create a new Xamarin.Forms Page using Xaml with control examples".  Name the page anything you want or keep the default name of Page1.

Result:
You'll get a page generated with this code behind code:
    public partial class Page1 : ContentPage
    {
        public Page1()
        {
            InitializeComponent();
            BindingContext = new ContentPageViewModel();
        }
    }

    class Page1ViewModel : INotifyPropertyChanged
    {
    ...

Note that the view model class is named Page1ViewModel but the code behind constructor tries to instantiate ContentPageViewModel instead of Page1ViewModel.  As a result, this code doesn't compile--ContentPageViewModel can't be found.
Comment 1 Pierce Boggan [MSFT] 2017-03-07 16:29:51 UTC

*** This bug has been marked as a duplicate of bug 52985 ***
Comment 2 Pierce Boggan [MSFT] 2017-03-07 16:30:08 UTC
Thanks for the report, Bret! Marking as a duplicate of 52985 and reassigning to James.