Frame.NavigationService Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets the NavigationService that is used by this Frame to provide navigation services.

Namespace:   System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)

Public ReadOnly Property NavigationService As NavigationService

Property Value

Type: System.Windows.Navigation.NavigationService

A Frame object that represents the NavigationService used by this Frame, if one is available. Otherwise, null is returned.

Frame uses NavigationService to support navigation for hosted content. NavigationService is useful for code that hosts a Frame to get a reference to the NavigationService. Content that is hosted by a Frame, such as Page, should use GetNavigationService or NavigationService to get a reference to the NavigationService.

System_CAPS_noteNote

NavigationService does not return a reference to the same NavigationService as calling GetNavigationService and passing Frame does. The former returns the NavigationService that is owned by the Frame while the latter returns the NavigationService for the navigation host that navigated to the content in which the Frame is hosted. The following code demonstrates the differences.

Imports System.Windows.Controls
Imports System.Windows.Navigation
' 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)

.NET Framework
Available since 3.0
Return to top
Show: