Export (0) Print
Expand All

Frame.NavigationService Property

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

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

public NavigationService NavigationService { get; }
You cannot set this property in XAML.

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.

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.

using System.Windows.Controls; // Frame
using System.Windows.Navigation; // NavigationService


...


// 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);

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0

Community Additions

ADD
Show:
© 2014 Microsoft