1、使用Frame跳转页面
1.1 前台代码
<!--显示内容-->
<Frame x:Name="mainFrame" Source="/Index.xaml" NavigationUIVisibility="Hidden"/>
1.2 后台代码
/// <summary>
/// 使用Frame跳转页面
/// </summary>
private void JumpPage(string uid)
{
if (!String.IsNullOrWhiteSpace(uid))
{
this.mainFrame.Navigate(new Uri(uid, UriKind.Relative));
}
}
2、使用NavigationWindow弹出页面
2.1 后台代码
/// <summary>
/// 弹出层对象
/// </summary>
public static NavigationWindow window = null;
/// <summary>
/// 使用NavigationWindow弹出页面
/// </summary>
private void ShowNavigationWindow(string title, string uri, int width, int height)
{
window = new NavigationWindow();
window.Title = title;
window.Width = width;
window.Height = height;
window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
window.ResizeMode = ResizeMode.NoResize;
window.Source = new Uri(uri, UriKind.Relative);
window.ShowsNavigationUI = false;
window.Show();
}
/// <summary>
/// 关闭弹出层
/// </summary>
private void CloseNavigationWindow()
{
window.Close();
}