This source code contains the MAUI default project generated by visual Studio 2022 transformed in a MVVM way.
The initial source code is obtained by creating a new MAUI project in Visual Studio 2022 Preview. The source code is not MVVM compliant.
For now, the current version of MAUI is preview 14.
-
In the project, Create folders: Pages and ViewModels.
-
Move MainPage.xaml in the folder Pages.
-
In ViewModels, Create BaseViewModel.cs, MainViewModel.cs.
-
Modify Mainpage.xaml:
Bind the page to the view model. -
Bind label and button to the view model.
-
Modify MainPage.xaml.cs
Remove the backend code.
For more ressources, see: