Introduction
This article demonstrates how to create MVVM Data Binding Application using C# and XML in Xamarin.Forms.
Let’s start.
Step 1
Open Visual Studio. Go to New Project >> Installed >> Visual C# >> Cross-Platforms >> Cross-Platform App (Xamarin).
Select Cross-Platform App, then give project name and project location.
Step 2
Next, go to Solution Explorer >> Project Name (Portable), then right-click to Add >> New Folder. It opens a new dialog box; give the name to your Model.
Go to Project Name >> Model. Right-click to Add >> Class. This opens a new dialog box. Give a name to TaskModel.cs.
Step 3
Next, open Solution Explorer >> Project Name >> Model >> TaskModel.cs. Click to open C# code. Then, give the following code.
- namespace MVVMDataBinding.Model
- {
- public class TaskModel
- {
- public string Title { get; set; }
- public int Duration { get; set; }
- public string State { get; set; }
- }
- }
Similarly, add a new folder under Class page, then give the name for ViewModel and HomeViewModels.cs.
Step 5
Next, open Solution Explorer >> Project Name >> ViewModel >> HomeViewModel then click open C# code. Give the following code.
- using MVVMDataBinding.Model;
- namespace MVVMDataBinding.ViewModel
- {
- public class HomeViewModels
- {
- public TaskModel TaskModel { get; set; }
- public HomeViewModels()
- {
- TaskModel = new TaskModel
- {
- Title = "Create India",
- Duration = 2,
- State = "Tamil Nadu",
- };
- }
- }
- }

Ahmed HADDADPosted Apr 26, 2019, 4:27 AM
Good, but where is the database , what is the serve of a module if it dosen't map to a database ?