I have several ContentPages, and I want to go from one to another when I click an element on the page. I have a ViewModel class:
class JumpVM : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; private INavigation _navigation; public ICommand NewPage { get { return new Command(async () => { await _navigation.PushAsync(new MySettingsPage()); }); } } public JumpVM() { } public JumpVM(INavigation navitation) { _navigation = navitation; } }
And this is one of my pages (for the sake of space, I put only the appropriate code):
BindingContext = new JumpVM(this.Navigation);
....
Image fbInvite = new Image { Source = ImageSource.FromResource(Constants.ASSETLOCATION + ".facebookInviteIcon.png"), HorizontalOptions = LayoutOptions.Center }; fbInvite.GestureRecognizers.Add(new TapGestureRecognizer(sender => {
I want to click an image to execute a command in the JumpVM class, and go to the page there. How can i do this?
c # mvvm xamarin xamarin.forms
Dragos
source share