Frame.NavigationService Właściwość

Definicja

Pobiera wartość NavigationService używaną 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 obiekt używany przez ten Frameobiekt , jeśli jest dostępny. null W przeciwnym razie zwracana jest wartość .

Uwagi

Frame używa NavigationService do obsługi nawigacji dla hostowanej zawartości. NavigationServiceJest przydatny w przypadku kodu hostujące element , Frame aby uzyskać odwołanie do .NavigationService Zawartość hostowana przez element Frame, taki jak Page, powinna używać GetNavigationService metody lub NavigationService , aby uzyskać odwołanie do elementu NavigationService.

Uwaga

NavigationService nie zwraca odwołania do tego samego NavigationService , co wywołanie GetNavigationService i przekazywanie Frame . Pierwsza metoda zwraca NavigationService wartość, która 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