语言

Frame.NavigationService 属性

定义

NavigationService获取用于Frame提供导航服务的项。

public:
 property System::Windows::Navigation::NavigationService ^ NavigationService { System::Windows::Navigation::NavigationService ^ get(); };
public System.Windows.Navigation.NavigationService NavigationService { get; }
member this.NavigationService : System.Windows.Navigation.NavigationService
Public ReadOnly Property NavigationService As NavigationService

属性值

一个 Frame 对象,表示 NavigationService 此 Frame对象(如果可用)。 否则将返回 null。

注解

Frame 用于 NavigationService 支持托管内容的导航。 对于承载 a 以获取对 <a0/> 的引用的代码非常有用。 由诸如此类托管的内容应使用或获取对 &a0> 的引用。

注释

NavigationService不返回对调用NavigationService和传递GetNavigationService相同的Frame引用。 前者返回 NavigationService 所拥有 Frame 的,而后者返回 NavigationService 导航到托管内容的 Frame 导航主机。 以下代码演示了差异。

using System.Windows.Controls;
using System.Windows.Navigation;
Imports System.Windows.Controls
Imports System.Windows.Navigation
// Get the NavigationService owned by the Frame
NavigationService frameNS = this.frame.NavigationService;

// Get the NavigationService for the navigation host that navigated
// to the content in which the Frame is hosted
NavigationService navigationHostNS = NavigationService.GetNavigationService(this.frame);
' Get the NavigationService owned by the Frame
Dim frameNS As NavigationService = Me.frame.NavigationService

' Get the NavigationService for the navigation host that navigated
' to the content in which the Frame is hosted
Dim navigationHostNS As NavigationService = NavigationService.GetNavigationService(Me.frame)

适用于