这里有个方法非常简单:思路很简单,就是循环找到当前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);
}
|