Created
July 27, 2019 18:06
-
-
Save juucustodio/c9581edd05b40f09d3e6312af4bcc3c4 to your computer and use it in GitHub Desktop.
Example of how to work with MVVM pattern using the MVVMCoffee nuget package - http://julianocustodio.com/mvvmcoffee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using MVVMCoffee.ViewModels; | |
using Xamarin.Forms; | |
namespace Sample.ViewModels | |
{ | |
public class MainViewModel : BaseViewModel | |
{ | |
public Command PushAsyncToFormCommand { get; } | |
public Command SetRootFormCommand { get; } | |
public MainViewModel() | |
{ | |
TitlePage = "MainPage"; | |
PushAsyncToFormCommand = new Command(ExecutePushAsyncToFormCommand); | |
SetRootFormCommand = new Command(ExecuteSetRootFormCommand); | |
} | |
private async void ExecutePushAsyncToFormCommand() | |
{ | |
await Navigation.PushAsync<FormViewModel>(false); | |
} | |
private async void ExecuteSetRootFormCommand() | |
{ | |
await Navigation.SetRootAsync<FormViewModel>(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment