一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

wpf实现框架frame中旧页面跳转新页面

时间:2014-06-17 编辑:简简单单 来源:一聚教程网

这里有个方法非常简单:思路很简单,就是循环找到当前page的parent window,找到最顶级的然后跳转即可。

 代码如下 复制代码

Frame pageFrame = null;
  DependencyObject currParent = VisualTreeHelper.GetParent(this);
  while (currParent != null && pageFrame == null)
  {
 pageFrame = currParent as Frame;
 currParent = VisualTreeHelper.GetParent(currParent);
  }
  // Change the page of the frame.
  if (pageFrame != null)
  {
 pageFrame.Source = new Uri("WindowPages/LawCase/LawCasePanel.xaml", UriKind.Relative);
}

热门栏目