Navigation WithParams not setting VM property - CM 1.2 / WP7 Mango

Topics: Framework Services
Aug 14, 2011 at 11:23 PM

Hi Guys,

Just wondering if someone can help me with the following issue.

I am try to perform a navigation from one page to another using the Navigation service provided by CM 1.2.

I using the following syntax -

nav.UriFor<ItemViewModel>().WithParams(x=> x.Id, 5).Navigate();

The navigation seems to go okay, the VM is created fine and the page gets loaded. The only problem is that the public property Id does not get populated.

Is this the correct way to use the NavigationService?



Aug 14, 2011 at 11:29 PM

that is the correct format.  just make sure that the property is public and an auto property public int Id {get;set;} for example.


Where are you using the property? ctor?

Aug 15, 2011 at 12:23 AM

Hi mvermef,

Many thanks for your response.

Yes, my property was defined like this in the VM - public int Id { get; set; }

However, it was your last question that actually helped me find the answer.

I was hoping to use the Id in another property that was bound to the view using Bindings. At this point the Id value is not yet populated.

I moved my code to the OnViewReady function and now I am able to retrieve the Id and everything works as expected.





Aug 16, 2011 at 7:28 PM

great to hear it is working as expected.