标签:
方法一:使用代码
<WpfUI:View.CommandBindings>
<CommandBinding Command="Help"
CanExecute="HelpCanExecute"
Executed="HelpExecuted"
/>
</WpfUI:View.CommandBindings>
#region Command
private void HelpCanExecute(object sender, CanExecuteRoutedEventArgs e)
{
e.CanExecute = true;
}
private void HelpExecuted(object sender, ExecutedRoutedEventArgs e)
{
System.Diagnostics.Process.Start("http://www.baidu.com");
}
#endregion Command
构造函数
public TallyBookView()
{
InitializeComponent();
this.InputBindings.Add(
new KeyBinding(ApplicationCommands.Help, new KeyGesture(Key.F2)));
}
上面等同于如下代码:
标签:
原文地址:http://www.cnblogs.com/changbaishan/p/4585256.html