Christofer Ohlsson
Christofer Ohlsson

Reputation: 3145

Just creating a new Xamarin Forms Content Page Xaml makes the project uncompilable as ContentPageViewModel is uknown

Adding this to my PCL, the code behind file has this line:

BindingContext = new ContentPageViewModel();

In the constructor. The compiler does not know about ContentPageViewModel.

How is it possible that things break this fast? Am I not supposed to use ContentPages with a Xamarin Forms app?

Upvotes: 2

Views: 150

Answers (2)

Nick
Nick

Reputation: 31

The name of my file was GreetPage.xaml.cs. Just substitute out 'ContactPage' for the name of your file.

enter image description here

Upvotes: 3

Gerald Versluis
Gerald Versluis

Reputation: 34128

It seems that this is a bug in the current templates. Check the bug on the Xamarin Bugzilla here.

You can work around it by implementing the actual ViewModel yourself, or just removing the line if you do not wish to use it.

Upvotes: 3

Related Questions