Search code examples
buttonbindingxamarinxamarin.androidmvvmcross

Bind Button to start other Activity on Mvvmcross


first i use Xamarin, visual Studio and Mvvmcross.

on one of my Tabs are 3 Buttons. Everyone starts a new Activity. My question is how i have to bind this Buttons and more interesting is the question how the command look to start a new Activity. My problem is not the Binding of the Button to a Comand. its how can i start a other Activity from the ViewModel.

i can Binding a Button to a Command like Save data ore some thing. but all thinks that use on the "Buisnesslayer"

thx and Greets


Solution

  • In your view model you would have your ICommand like so:

    public ICommand GoSimpleCommand
        {
            get { return new MvxCommand(() => ShowViewModel<SimpleViewModel>()); }
        }
    

    See navigation example here.