I am using Silverlight 4 + PRISM + MVVM in my application. I want to pass a complex object to another page. I dont know how to do that. I cant/dont want to use URI parameters.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I implemented INavigationAware interface, and set the complex object in navigationContext.NavigationService.Region.Context in OnNavigatedFrom() method. Now in the next page, again I implemented INavigationAware interface and now I check for the same value in OnNavigatedTo() to get the value.
Update: I posted answer with code in another question. Mentioning it here for reference –
First derive the viewmodel from INavigationAware interface –
You can then implement OnNavigatedFrom and set the object you want to pass as navigation context as follows –
and when you want to receive the data, add the following piece of code in the second view model –
hope it helps you all!