Reloading the same page passing another parameters
I'm developing a Windows Phone application.
I have defined this on App.xaml:
<nav:UriMapping Uri="/Destinations" MappedUri="/Views/Tourism/Common.xa开发者_高级运维ml?Type=1"/>
<nav:UriMapping Uri="/Points" MappedUri="/Views/Tourism/Common.xaml?Type=2"/>
When the user is on Points, and I do the following:
NavigationService.Navigate(new Uri("/Destinations", UriKind.Relative));
I get the error: No Fragment support right now
How can I reload the same page passing a Type 1?
NOTE: I use custom transition between pages, this the reason I'm navigating to the same page.
Thanks.
What is the difference between Type 1 and Type 2? If you're displaying a different layout, I'd suggest you would be better off using the Visual State Manager with two different states. You can trigger these using GoToState, or through behaviours in Blend.
If just the data is changing, then using MVVM you should only have to signal the change to your ViewModel, and the new state will be displayed.
Some of the examples use the full page uri with params:
NavigationService.Navigate(new Uri("/NextPage.xaml?Value=" + Value, UriKind.Relative));
And then retrieve it like:
string value = "";
if (NavigationContext.QueryString.TryGetValue("Value", out value)) { ... }
not sure how that's any different than using the URIMapping stuff you're doing, but it should be possible...
精彩评论