Język

Frame.NavigationService Właściwość

Definicja

Pobiera element NavigationService używany przez tę Frame usługę do świadczenia usług nawigacji.

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

Wartość właściwości

Frame Obiekt reprezentujący NavigationService używany przez ten Frameobiekt , jeśli jest dostępny. W przeciwnym razie jest zwracana. null

Uwagi

Frame używa NavigationService do obsługi nawigacji dla hostowanej zawartości. NavigationService jest przydatny w przypadku kodu, który hostuje element , Frame aby uzyskać odwołanie do elementu NavigationService. Zawartość hostowana przez element Frame, taki jak Page, powinna być używana GetNavigationService lub NavigationService w celu uzyskania odwołania do elementu NavigationService.

Note

NavigationService nie zwraca odwołania do tego samego NavigationService , co wywołanie GetNavigationService i przekazywanie Frame . Pierwszy zwraca NavigationService element, który jest własnością Frame elementu , a drugi zwraca NavigationService wartość dla hosta nawigacji, który przechodzi do zawartości, w której jest hostowany Frame . Poniższy kod demonstruje różnice.

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)

Dotyczy