Assembly: PresentationFramework (in PresentationFramework.dll)
Frame uses NavigationService to support navigation for hosted content. 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.
does not return a reference to the same as calling GetNavigationService and passing Frame does. The former returns the that is owned by the Frame while the latter returns the 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 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)