Frame.NavigationService Eigenschap

Definitie

Hiermee haalt u de NavigationService gegevens op die hiermee Frame worden gebruikt om navigatieservices te bieden.

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

Waarde van eigenschap

Een Frame object dat het NavigationService gebruikte object Framevertegenwoordigt, indien beschikbaar. Anders null wordt het teruggegeven.

Opmerkingen

Frame gebruikt NavigationService ter ondersteuning van navigatie voor gehoste inhoud. NavigationService is handig voor code die als Frame host fungeert voor een verwijzing naar de NavigationService. Inhoud die wordt gehost door een , zoals Frame, moet een PageGetNavigationService verwijzing naar de NavigationService.NavigationService

Note

NavigationService retourneert geen verwijzing naar hetzelfde NavigationService als bellen GetNavigationService en doorgeven Frame . De vorige retourneert de NavigationService waarde die eigendom is van de Frame terwijl de laatste de NavigationService voor de navigatiehost retourneert die naar de inhoud waarin de Frame host wordt gehost. De volgende code laat de verschillen zien.

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)

Van toepassing op