KeyRoutedEventArgs Class

Stellt Daten für die Routingereignisse KeyUp und KeyDown sowie verwandte angefügte und Vorschauereignisse bereit.

Vererbung

Object
  RoutedEventArgs
    KeyRoutedEventArgs

Syntax


public sealed class KeyRoutedEventArgs : RoutedEventArgs

Attribute

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

Member

KeyRoutedEventArgsKlasse hat diese Membertypen:

Methoden

The KeyRoutedEventArgs Klasse erbt Methoden von Object Klasse.

Eigenschaften

Der KeyRoutedEventArgsKlasse hat diese Eigenschaften.

EigenschaftZugriffstypBeschreibung

Handled

Lese-/SchreibzugriffGets or sets a value that marks the routed event as handled. A true value for Handled prevents most handlers along the event route from handling the same event again.

Key

SchreibgeschütztGets the keyboard key associated with the event.

KeyStatus

SchreibgeschütztGets a structure value that reports various system-detected characteristics of the key press, including repeat count and menu status.

OriginalSource

SchreibgeschütztGets a reference to the object that raised the event. (Geerbt von RoutedEventArgs)

 

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.Input
Windows::UI::Xaml::Input [C++]

Metadaten

Windows.winmd

Siehe auch

RoutedEventArgs
WebView
Beispiel für ein XAML-WebView-Steuerelement

 

 

Anzeigen:
© 2014 Microsoft