Occurs when navigation to a content fragment begins, which occurs immediately, if the desired fragment is in the current content, or after the source XAML content has been loaded, if the desired fragment is in different content.
Assembly: PresentationFramework (in PresentationFramework.dll)
You navigate to a XAML fragment by providing a URI with a suffix in the following format:
The following shows an example of a URI that refers to a content fragment:
After the source page loads (after LoadCompleted event is raised), fragment navigation begins and the NavigationService attempts to locate the XAML fragment. If the XAML fragment is found, NavigationService instructs the content navigator (NavigationWindow, Frame) to show the fragment. If you need to change this behavior, you can handle to provide your own fragment navigation behavior. is passed a FragmentNavigationEventArgs parameter which exposes properties that are useful for this purpose, including:
You can handle Handled to true; otherwise, the default WPF fragment processing behavior is applied.to override the default WPF fragment implementation with your own custom implementation. If you do so, you need to set
You should avoid directly initiating navigation from within a ExecutionEngineException to be thrown. Instead, you can indirectly initiate navigation by creating an asynchronous work item using the Dispatcher.event handler. Since is raised during an existing navigation, initiating a new navigation from a event handler creates a nested navigation that can cause the
Fragment navigation is not supported for loose XAML pages (markup-only XAML files with Page as the root element) in the following cases:
• When navigating to a fragment in a loose XAML page.
• When navigating from a loose XAML page to a fragment in another loose XAML page.
However, a loose XAML page can navigate to its own fragments.
Available since 3.0
Available since 3.0
Windows Phone Silverlight
Available since 7.0