Frame.NavigationService Propiedad

Definición

Obtiene el NavigationService objeto utilizado por este Frame para proporcionar servicios de navegación.

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

Valor de propiedad

Objeto Frame que representa el NavigationService utilizado por este Frame, si hay uno disponible. En caso contrario, devuelve null.

Comentarios

Frame usa NavigationService para admitir la navegación para el contenido hospedado. NavigationServicees útil para el código que hospeda para Frame obtener una referencia a .NavigationService El contenido hospedado por , Framecomo Page, debe usar GetNavigationService o NavigationService para obtener una referencia a .NavigationService

Note

NavigationService no devuelve una referencia a la misma NavigationService que la llamada GetNavigationService y el paso Frame . El primero devuelve el NavigationService que es propiedad de Frame mientras que el último devuelve el NavigationService para el host de navegación que ha navegado al contenido en el Frame que se hospeda . En el código siguiente se muestran las diferencias.

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)

Se aplica a