Skip to content

Instantly share code, notes, and snippets.

@Adam--
Last active August 29, 2015 14:28
Show Gist options
  • Save Adam--/963889b1dcc5b84089d5 to your computer and use it in GitHub Desktop.
Save Adam--/963889b1dcc5b84089d5 to your computer and use it in GitHub Desktop.
MvvmCross binding examples
/// <summary>
/// Show the view model.
/// </summary>
[MvxCommand("ShowCommand")]
public void Show()
{
this.ShowViewModel<MainViewModel>();
}
local:MvxBind="Click ShowCommand"
/// <summary>
/// Show the view model.
/// </summary>
public void ShowCommand()
{
this.ShowViewModel<MainViewModel>();
}
/// <summary>
/// Backing field for my command.
/// </summary>
private MvxCommand showCommand;
/// <summary>
/// Gets My Command.
/// <para>
/// An example of a command and how to navigate to another view model
/// Note the ViewModel inside of ShowViewModel needs to change!
/// </para>
/// </summary>
public ICommand ShowCommand
{
get
{
return this.showCommand ?? (this.showCommand = new MvxCommand(this.Show));
}
}
/// <summary>
/// Show the view model.
/// </summary>
public void Show()
{
this.ShowViewModel<MainViewModel>();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment