NavigationEventArgs class

Applies to Windows and Windows Phone

Provides data for navigation methods and event handlers that cannot cancel the navigation request.

Inheritance

Object
  NavigationEventArgs

Syntax


public ref class NavigationEventArgs sealed 

Attributes

[MarshalingBehavior(Agile)]
[Threading(Both)]
[Version(0x06020000)]
[WebHostHidden()]

Members

The NavigationEventArgs class has these types of members:

Methods

The NavigationEventArgs class inherits methods from the Object class.

Properties

The NavigationEventArgs class has these properties.

PropertyAccess typeDescription

Content

Read-onlyGets the root node of the target page's content.

NavigationMode

Read-onlyGets a value that indicates the direction of movement during navigation

NavigationTransitionInfo

Read-onlyGets a value that indicates the animated transition associated with the navigation.

Parameter

Read-onlyGets any Parameter object passed to the target page for the navigation.

SourcePageType

Read-onlyGets the data type of the source page.

Uri

Read/writeGets the Uniform Resource Identifier (URI) of the target.

 

Examples

The following example code demonstrates the use of this type. For the complete code listing, see the XAML WebView control sample.


void SDKSample::WebViewControl::Scenario1::NavigateButton_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
    ProgressRing1->IsActive = true;

    // Provide an indication as to where we are trying to navigate to
    String^ str = "Navigating to: {0}" + Address->Text;
    rootPage->NotifyUser(str, NotifyType::StatusMessage);

    // Hook the LoadCompleted event for the WebView to know when the URL is fully loaded
    WebView1->LoadCompleted += ref new LoadCompletedEventHandler(this, &Scenario1::WebView1_LoadCompleted);

    // Attempt to navigate to the specified URL.  Notice that a malformed URL will raise a FormatException
    // which we catch and let the user know that the URL is bad and to enter a new well-formed one.
    try
    {
        Uri^ targetUri = ref new Uri(Address->Text);
        WebView1->Navigate(targetUri);
    }
    catch (FailureException^ myE)
    {
        // Bad address
        String^ str = "Address is invalid, try again.  Details --> {0}" + myE->Message;
        rootPage->NotifyUser(str, NotifyType::ErrorMessage);
    }    
}

void SDKSample::WebViewControl::Scenario1::WebView1_LoadCompleted(Platform::Object^ sender, Windows::UI::Xaml::Navigation::NavigationEventArgs^ e)
{
    WebView1->Visibility = Windows::UI::Xaml::Visibility::Visible;
    BlockingRect->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
    ProgressRing1->IsActive = false;
    
    // Tell the user that the page has loaded
    rootPage->NotifyUser("Page loaded", NotifyType::StatusMessage);
}


void SDKSample::WebViewControl::Scenario1::Address_KeyUp(Platform::Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e)
{
     if (e->Key == Windows::System::VirtualKey::Enter)
    {
        NavigateButton_Click(this, ref new RoutedEventArgs());
    }
}


Requirements

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.UI.Xaml.Navigation
Windows::UI::Xaml::Navigation [C++]

Metadata

Windows.winmd

See also

WebView
XAML WebView control sample

 

 

Show:
© 2014 Microsoft