Intersoft ClientUI Documentation
OnChildNavigation Method
Example 



An object that contains the event data.
Called when a child page has been successfully navigated within the parent frame context.
Syntax
Protected Overridable Sub OnChildNavigation( _
   ByVal e As ChildNavigationEventArgs _
) 
Dim instance As UXPage
Dim e As ChildNavigationEventArgs
 
instance.OnChildNavigation(e)
protected virtual void OnChildNavigation( 
   ChildNavigationEventArgs e
)
protected:
virtual void OnChildNavigation( 
   ChildNavigationEventArgs^ e
) 

Parameters

e
An object that contains the event data.
Remarks

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.

Example
The following example shows how to invalidate the data context when the page of the child frame has changed.
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);
    }

    ...
}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

UXPage Class
UXPage Members
Navigation Overview

Send Feedback