如果我执行明确实施的
ICommand.Execute(object parameter)
在RoutedCommand上的方法,该命令按预期执行。 RoutedCommand中必须有逻辑来解析执行命令的位置。也许是通过StackTrace完成的?可能与调用RoutedCommand.Execute(参数,null)相同。
有人了解更多关于此主题(逻辑,可靠性)还是有一个很好的分享链接?
答案 0 :(得分:2)
如果您使用Reflector查看实现,看起来它使用Keyboard.FocusedElement来确定目标。
void ICommand.Execute(object parameter)
{
this.Execute(parameter, FilterInputElement(Keyboard.FocusedElement));
}