您的位置:首页 > 理论基础 > 计算机网络

http://blog.sina.com.cn/s/blog_4c0e8aa20100ung8.html

2015-07-28 11:31 513 查看
因此我采用的是另一种方式,也是在网上查找的,不过网址个忘了,现在只剩下程序了。

实现的办法如下所示:

<Window.Resources>

<RoutedUICommand x:Key="searchKey" Text="FaskDemo"
/>

</Window.Resources>

<windows.inputBindings>

<KeyBinding Command="{StaticResource
searchKey}" Key="F3"/> </windows.inputBindings>

<Window.CommandBindings>

<CommandBinding
Command="{StaticResource searchKey}" CanExecute="CommandBinding_CanExecute_F3"

"/>

</Window.CommandBindings>

这是前面的xmal要做的事情,当然,我们要执行的那个FaskDemo_Click我们还的实现以下啊,那么就如下所示了:

private void CommandBinding_CanExecute_F3(object sender, CanExecuteRoutedEventArgs e)

{

Console.WriteLine("LeoZhao 讲鬼故事");

}

这样就OK了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: