I'm using Mvvmlight INavigationService in the project, from view model I navigate to a view , and pass object as parameter ,how do I get either in the view model or in the code behind.
I have implemented based on this
My View model locator
private static INavigationService CreateNavigationService()
{
var navigationService = new NavigationService();
navigationService.Configure("topupdetails", new System.Uri("/Views/TopUpDetails.xaml", System.UriKind.Relative));
return navigationService;
}
View Model command executes
private void OnTapCommand(MyModel tappedItem)
{
if (tappedItem._verified)
{
SimpleIoc.Default.GetInstance<INavigationService>().NavigateTo("topupdetails",tappedItem);
}
Page I navigated to
protected override void OnNavigatedTo(NavigationEventArgs e)
{
if (NavigationContext.QueryString.Any())
{
var item = NavigationContext.QueryString.Values.First();
}
base.OnNavigatedTo(e);
}
In query string I just value like this "e-fghfdsfsd" but cant cast to my class object , Can I get the value in view model or in the code-behind which is best way to do this , with a minimum code in code-behind ?
Mvvmlight Version: Mvvmlight 5 Laurent Mvvmlight 5 Announcement
I have also referred this