Visual Basic (Declaration) | |
---|---|
Protected Overridable Sub OnChildNavigation( _ ByVal e As ChildNavigationEventArgs _ ) |
Visual Basic (Usage) | ![]() |
---|---|
Dim instance As UXPage Dim e As ChildNavigationEventArgs instance.OnChildNavigation(e) |
C# | |
---|---|
protected virtual void OnChildNavigation( ChildNavigationEventArgs e ) |
Delphi | |
---|---|
protected procedure OnChildNavigation( e: ChildNavigationEventArgs ); virtual; |
JScript | |
---|---|
protected function OnChildNavigation( e : ChildNavigationEventArgs ); |
Managed Extensions for C++ | |
---|---|
protected: virtual void OnChildNavigation( ChildNavigationEventArgs* e ) |
C++/CLI | |
---|---|
protected: virtual void OnChildNavigation( ChildNavigationEventArgs^ e ) |
Parameters
- e
- An object that contains the event data.
C# | ![]() |
---|---|
public partial class Customers : UXPage { public MobilePhones() { InitializeComponent(); } protected override void OnNavigatedFrom(NavigationEventArgs e) { base.OnNavigatedFrom(e); } // Executes when the user navigates to this page. protected override void OnNavigatedTo(NavigationEventArgs e) { LoadData(this.NavigationContext.QueryString); } // Called when a child navigation has occurred. protected override void OnChildNavigation(ChildNavigationEventArgs e) { LoadData(e.QueryString); } ... } |
When a navigation occurred only at the child frame, the parent frame is not reloaded. The ClientUI navigation framework is designed this way to produce smooth user experiences. Since the parent frame is not reloaded, the navigation events for the parent frame are not raised. In certain cases, you need to track when the child page has changed and that the parent page needs to do certain actions, such as invalidating properties or assigning the data context.
ClientUI provides ChildNavigation routed event which is raised when a child page has been successfully navigated within the parent frame context. In most cases, you might be interested to handle the child navigation event in the page level instead of implementing the routed event in the frame level. This can be done by overriding the OnChildNavigation protected method of the UXPage class.
One of the benefits of using the OnChildNavigation method override in the UXPage is that you can easily obtain the QueryString of the current navigation context which is passed from the parent frame. Since the QueryString uses the same signature as in NavigationContext, you can refactor your code to be efficiently called from various entry points in the code.
Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family