RoutedCommand上的ICommand.Execute(对象参数)

时间:2010-06-23 09:47:35

标签: wpf

如果我执行明确实施的

ICommand.Execute(object parameter)
在RoutedCommand上的

方法,该命令按预期执行。 RoutedCommand中必须有逻辑来解析执行命令的位置。也许是通过StackTrace完成的?可能与调用RoutedCommand.Execute(参数,null)相同。

有人了解更多关于此主题(逻辑,可靠性)还是有一个很好的分享链接?

1 个答案:

答案 0 :(得分:2)

如果您使用Reflector查看实现,看起来它使用Keyboard.FocusedElement来确定目标。

void ICommand.Execute(object parameter)
{
    this.Execute(parameter, FilterInputElement(Keyboard.FocusedElement));
}