There is a querystring method, but it can be kind of a pain to implement.
When navigating, execute a parameter similar to HTTP requests.
Then, on the other hand, check if the key exists and retrieve the value. The disadvantage of this is that if you need to do more than 1, you need to enter it into yourself, and it only supports strings.
So, to pass an integer, you need to convert it. (And in order to convey a complex object, you need to take all the parts that you need to recompile on the other side)
NavigationService.Navigate(new Uri("/PanoramaPage1.xaml?selected=item2", UriKind.Relative));
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
string selected = String.Empty;
if (NavigationContext.QueryString.ContainsKey("selected"))
{
selected = NavigationContext.QueryString["selected"];
}
if (selected == "item2")
{
myPanorama.DefaultItem = myPanorama.Items[1];
}
base.OnNavigatedTo(e);
}
, .
http://dl.dropbox.com/u/129101/Panorama_querystring.zip
( ) , . App.xaml.cs
using System.Collections.Generic;
public static Dictionary<string,object> PageContext = new Dictionary<string,object>;
MyComplexObject obj;
int four = 4;
...
App.PageContext.Add("mycomplexobj",obj);
App.PageContext.Add("four",four);
MyComplexObj obj = App.PageContext["mycomplexobj"] as MyComplexObj;
int four = (int)App.PageContext["four"];
, , , , :
if (App.PageContext.ContainsKey("four"))
int four = (int)App.PageContext["four"];