Intersoft ClientUI Documentation
OnNavigatedTo(NavigationEventArgs) Method
See Also  Example Send Feedback
Intersoft.Client.UI.Navigation Namespace > UXPage Class : OnNavigatedTo(NavigationEventArgs) Method






e
An object that contains the event data.
Called when the page becomes the active content in the navigation frame.

Syntax

Visual Basic (Declaration) 
Protected Overridable Sub OnNavigatedTo( _
   ByVal e As NavigationEventArgs _
) 
Visual Basic (Usage)Copy Code
Dim instance As UXPage
Dim e As NavigationEventArgs
 
instance.OnNavigatedTo(e)
C# 
protected virtual void OnNavigatedTo( 
   NavigationEventArgs e
)
Delphi 
protected procedure OnNavigatedTo( 
    e: NavigationEventArgs
); virtual; 
JScript 
protected function OnNavigatedTo( 
   e : NavigationEventArgs
);
Managed Extensions for C++ 
protected: virtual void OnNavigatedTo( 
   NavigationEventArgs* e
) 
C++/CLI 
protected:
virtual void OnNavigatedTo( 
   NavigationEventArgs^ e
) 

Parameters

e
An object that contains the event data.

Example

The following example shows how to override the OnNavigatedTo method to obtain the query string that passed from the navigation context, set the data context and display the data accordingly.

C#Copy Code
// Executes when the user navigates to this page.
protected override void OnNavigatedTo(NavigationEventArgs e)
{
    if (this.NavigationContext.QueryString.Count > 0)
    {
        string customerID = this.NavigationContext.QueryString["ID"];

        if (!string.IsNullOrEmpty(customerID))
        {
            // Binds the view model to data context
            // The view model loads the selected contact based on 
            // the data passed in the QueryString.
            this.DataContext = new ContactDetailsViewModel((ContactsViewModel)this.DataContext, customerID);

            // hide info label
            InfoLabel.Visibility = Visibility.Collapsed;

            return;
        }
    }

    // hide details panel
    DetailsPanel.Visibility = Visibility.Collapsed;
}

Remarks

You override the OnNavigatedTo method to examine the navigation request and prepare the page for display. For example, you can load the requested data and enable or disable visual elements.

Typically, you use the OnNavigatedTo method instead of creating an event handler for the Loaded event. The OnNavigatedTo method is preferable because it is only called once for each time the page becomes active. The Silverlight framework raises the Loaded event each time the element is added to the visual tree, which potentially can happen more than once when activating a page.

The OnNavigatedTo method is called for each request, even when the page is retrieved from the cache. You should include in this method code that must be executed for each request rather than placing that code in the UXPage constructor.

Requirements

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

See Also

© 2012 All Rights Reserved.