信息
您所需的主题如下所示。但此主题未包含在此库中。
此主题尚未评级 - 评价此主题

KeyRoutedEventArgs Class

KeyUpKeyDown 路由事件以及相关的附加事件和预览事件提供数据。

继承

Object
  RoutedEventArgs
    KeyRoutedEventArgs

语法


public sealed class KeyRoutedEventArgs : RoutedEventArgs

特性

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

成员

KeyRoutedEventArgs类 具有这些类型的成员:

方法

The KeyRoutedEventArgs 类 继承这些方法于:Object 类.

属性

KeyRoutedEventArgs类 具有这些属性。

属性访问类型说明

Handled

读/写Gets 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

只读Gets the keyboard key associated with the event.

KeyStatus

只读Gets a structure value that reports various system-detected characteristics of the key press, including repeat count and menu status.

OriginalSource

只读Gets a reference to the object that raised the event. (继承自RoutedEventArgs)

 

示例

下面的示例代码演示使用此类型。有关完整的代码列表,请参见XAML WebView 控件示例


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());
    }
}


要求

最低支持客户端

Windows 8 [仅 Windows 应用商店应用程序]

最低支持服务器

Windows Server 2012 [仅 Windows 应用商店应用程序]

命名空间

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

元数据

Windows.winmd

另请参见

RoutedEventArgs
WebView
XAML WebView 控件示例

 

 

本文是否对您有所帮助?
(1500 个剩余字符)
感谢您的反馈
显示:
© 2014 Microsoft. 版权所有。