Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Navigation using MVVM Light and Xamarin Forms in Cross Platform app

$
0
0

I am trying to navigate from one page to another using MessagingCenter and MVVMlight in my PCL based Xamarin project. I have 2 pages-Page1 & Page2. Both pages are bound to respective Viewmodels VM1 and VM2. All I want to do is to navigate from Page1 to Page2 when I click a button on Page1. I have a command in VM1 that binds to the button in Page1. Here is what I am doing in that command-

return _navigateCategoryCommand ?? (_navigateCategoryCommand = new RelayCommand (
() => {
MessagingCenter.Send(new EmptyNavigationMessage(),"Show Category View");
}));

And in my Page1.xaml.cs file I subscribe to the Message and use following code to navigate-

Navigation.PushAsync (new CategoryView () );

However even though I can debug through the complete CategoryView constructor after this, I still dont see it loading on phone. Is there something I am missing?

Thanks

Apurva


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>