如何确定框架内容
How to determine frame content
我使用 MyFrame.Navigate(typeof(Page2))
设置框架内容。如何获取当前显示的页面的信息。我想做地址栏之类的东西。
您可以通过查看 Frame 实例的 CurrentSourcePageType
和 SourcePageType
属性来获取对当前显示在框架上的类型的引用。
微软对它们的区别的解释如下:
CurrentSourcePageType and SourcePageType are normally the same value.
However, if the frame calls Navigate and the navigation is still in
progress, the CurrentSourcePageType is the value before the navigation
and the SourcePageType is the value being navigated to.
如果您试图从您的框架中获取 Page2 的实际实例,您可以按如下方式进行:
var frame = MyFrame;
var page2 = frame.Content as Page2;
Frame 的内容 属性 是代表当前显示内容的 UI 元素。
我使用 MyFrame.Navigate(typeof(Page2))
设置框架内容。如何获取当前显示的页面的信息。我想做地址栏之类的东西。
您可以通过查看 Frame 实例的 CurrentSourcePageType
和 SourcePageType
属性来获取对当前显示在框架上的类型的引用。
微软对它们的区别的解释如下:
CurrentSourcePageType and SourcePageType are normally the same value. However, if the frame calls Navigate and the navigation is still in progress, the CurrentSourcePageType is the value before the navigation and the SourcePageType is the value being navigated to.
如果您试图从您的框架中获取 Page2 的实际实例,您可以按如下方式进行:
var frame = MyFrame;
var page2 = frame.Content as Page2;
Frame 的内容 属性 是代表当前显示内容的 UI 元素。