NavigationEventArgs-Klasse

NavigationEventArgs Class

Stellt Daten für Navigationsmethoden und Ereignishandler bereit, die die Navigationsanforderung nicht abbrechen können.

Vererbung

Object
  NavigationEventArgs

Syntax


public sealed class NavigationEventArgs

Attribute

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

Member

NavigationEventArgsKlasse hat diese Membertypen:

Methoden

The NavigationEventArgs Klasse erbt Methoden von Object Klasse.

Eigenschaften

Der NavigationEventArgsKlasse hat diese Eigenschaften.

EigenschaftZugriffstypBeschreibung

Content

SchreibgeschütztGets the root node of the target page's content.

NavigationMode

SchreibgeschütztGets a value that indicates the direction of movement during navigation

NavigationTransitionInfo

SchreibgeschütztGets a value that indicates the animated transition associated with the navigation.

Parameter

SchreibgeschütztGets any Parameter object passed to the target page for the navigation.

SourcePageType

SchreibgeschütztGets the data type of the source page.

Uri

Lese-/SchreibzugriffGets the Uniform Resource Identifier (URI) of the target.

 

Beispiele

Das folgende Codebeispiel zeigt die Verwendung dieses Typs. Die vollständige Codeliste finden Sie unter Beispiel für ein XAML-WebView-Steuerelement.


private void NavigateButton_Click(object sender, RoutedEventArgs e)
{
    ProgressRing1.IsActive = true;

    // Provide an indication as to where we are trying to navigate to
    rootPage.NotifyUser(String.Format("Navigating to: {0}", Address.Text), NotifyType.StatusMessage);

    // Hook the LoadCompleted event for the WebView to know when the URL is fully loaded
    WebView1.LoadCompleted += new Windows.UI.Xaml.Navigation.LoadCompletedEventHandler(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 = new Uri(Address.Text);
        WebView1.Navigate(targetUri);
    }
    catch (FormatException myE)
    {
        // Bad address
        rootPage.NotifyUser(String.Format("Address is invalid, try again.  Details --> {0}", myE.Message), NotifyType.ErrorMessage);
    }
}

void WebView1_LoadCompleted(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 Address_KeyUp(object sender, KeyRoutedEventArgs e)
{
    if (e.Key == Windows.System.VirtualKey.Enter)
    {
        NavigateButton_Click(this, new RoutedEventArgs());
    }
}


Anforderungen

Mindestens unterstützter Client

Windows 8 [Nur Windows Store-Apps]

Mindestens unterstützter Server

Windows Server 2012 [Nur Windows Store-Apps]

Namespace

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

Metadaten

Windows.winmd

Siehe auch

WebView
Beispiel für ein XAML-WebView-Steuerelement

 

 

Anzeigen:
© 2017 Microsoft