How to pass an object to a page

3 replies. Last post: October 16, 2012 7:46 AM by Yudi
Tags :
  • (None)
  • New Discussion
  • New Question
  • New Product Feedback

How can I navigate to a page passing a class business object to it as parameter - using MVVM.


E.g.  NavigationServiceProvider.Navigate(new Uri(string.Format("/BookJob/{0}", e.Object.BookJob), UriKind

.Relative));
Where 'BookJob' is an class Object .  I get a fail here because NavigationContext only has string.
// Executes when the user navigates to this page.
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            if (this.NavigationContext.QueryString.Count > 0)
            {
                string id = this.NavigationContext.QueryString["ID"];
                if (!string.IsNullOrEmpty(id))
                {
                    this.DataContext = new BookJobViewModel(int.Parse(id));
                    return;
                }
            }
        }

Is there another way achieve this/

All times are GMT -5. The time now is 5:47 PM.
Previous Next