我有这个 xaml 代码:
<Window.InputBindings>
<KeyBinding Command="{Binding Path=KeyEnterCommand}" Key="Enter" />
</Window.InputBindings>
这就是我的 ViewModel 中的代码:
private RelayCommand _keyEnterCommand;
public ICommand KeyEnterCommand
{
get
{
if (_keyEnterCommand == null)
{
_keyEnterCommand = new RelayCommand(param => ExecuteKeyEnterCommand());
}
return _keyEnterCommand;
}
}
public void ExecuteKeyEnterCommand()
{
// Do magic
}
现在是我的问题,我怎样才能得到这个命令的发送者?