Frame.NavigationService Propriété

Définition

Obtient le NavigationService utilisé par ce Frame pour fournir des services de navigation.

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

Valeur de propriété

Objet Frame qui représente le NavigationService utilisé par ce Frame, s'il y en a un de disponible. Sinon, null est retournée.

Remarques

Frame utilise NavigationService pour prendre en charge la navigation pour le contenu hébergé. NavigationServiceest utile pour le code qui héberge un Frame pour obtenir une référence à .NavigationService Le contenu hébergé par un Frame, tel que Page, doit utiliser GetNavigationService ou NavigationService pour obtenir une référence à .NavigationService

Notes

NavigationService ne retourne pas une référence à la même NavigationService chose que l’appel GetNavigationService et le passage Frame . Le premier retourne le NavigationService qui appartient à tandis Frame que le second retourne le NavigationService pour l’hôte de navigation qui a accédé au contenu dans lequel Frame est hébergé. Le code suivant illustre les différences.

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)

S’applique à