Create a new folder called Views into the root folder of the MvvmCrossDemo.Uwp project. Add a Blank Page file called FirstView.xaml into the Views folder.
Open the FirstView.xaml.cs file and Change the base class of the FirstView class to MvxWindowsPage, like this:
usingMvvmCross.Platforms.Uap.Views;usingMvvmCross.ViewModels;usingMvvmCrossDemo.Core.ViewModels;// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238namespaceMvvmCrossDemo.Uwp.Views{ /// <summary> /// An empty page that can be used on its own or navigated to within a Frame. /// </summary> [MvxViewFor(typeof(FirstViewModel))]publicsealedpartialclassFirstView:MvxWindowsPage {publicFirstView() {this.InitializeComponent(); } }}
You might notice that we added a MvcViewForAttribute to the FirstView class. So MvvmCross can attach the right ViewModel to it.
Open the FirstView.xaml file, and replace the content with these codes: