(一、一般的页面跳转)
XAML
<HyperlinkButton NavigateUri="SecondPage.xaml" />
C# for MainPage.xaml.cs
private void MyButton_Click(object sender, RoutedEventArgs e)
{
NavigationService.Navigate(new Uri("/SecondPage.xaml",
UriKind.RelativeOrAbsolute));
}
C# for SecondPage.xaml.cs
private void BtnBack_Click(object sender, RoutedEventArgs e)
{
if (NavigationService.CanGoBack)
NavigationService.GoBack();
}
C# for MainPage.xaml.cs
private void MyButton_Click(object sender, RoutedEventArgs e)
{
NavigationService.Navigate(new Uri("/SecondPage.xaml?msg=" +
MyTB.Text, UriKind.RelativeOrAbsolute));
}
C# for SecondPage.xaml.cs
protected override void OnNavigatedTo
(System.Windows.Navigation.NavigationEventArgs e)
{
base.OnNavigatedTo(e);
string msg = "";
if (NavigationContext.QueryString.TryGetValue("msg", out msg))
MyTBl.Text = msg;
}
App app=Application.Current as App;
app.RootVisual=new older_homepage();
var root = App.Current.RootVisual as PhoneApplicationFrame;
root.Navigate(new Uri("/older/older_homepage.xaml", UriKind.RelativeOrAbsolute));