如何在Prism 4中为DelegateCommand启用KeyBinding?
我想在Prism4桌面应用程序中为DelegateCommand启用KeyBinding。例如,在我的XAML文件中,我有这个:
<Grid.InputBindings>
<KeyBinding Gesture="CTRL+A" Command="{Binding Command3}"/>
</Grid.InputBindings>
<StackPanel>
<Button Grid.Row="0" Grid.Column="1" Content="HitMe" prism:Click.Command="{Binding Command3}" />
</StackPanel>
在我的ViewModel中我有这个:
public DelegateCommand<string> Command3 { get; private set; }
private void ExecuteCommand3(string commandParameter)
{
Debug.WriteLine("ExecuteCommand3");
}
private bool CanExecuteCommand3(string commandParameter)
{
return true;
}
当我按下HitMe按钮时,调试行输出但按下CTRL + A无效。
我考虑过使用TestMvvmExample2341中的CommandReference类,但这似乎复制了Prism 4机制的功能。
是否有一种简单的方法让CTRL + A在Prism4中调用Command3?
没有找到相关结果
已邀请:
1 个回复
葛瞎说漓