Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/282.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 查找RouteEvent的目标_C#_Wpf_Routed Commands - Fatal编程技术网

C# 查找RouteEvent的目标

C# 查找RouteEvent的目标,c#,wpf,routed-commands,C#,Wpf,Routed Commands,当我执行routed命令时,假设: ApplicationCommands.Undo.Execute(null, this); WPF使用了一些魔法来找到适当的命令绑定,它在该绑定上执行ExecutedRoutedEventHandler 有没有办法获取要执行的CommandBinding(或至少是处理程序)的引用 有时,知道谁在处理命令对调试来说是件好事。您可以尝试在以下位置查看CommandBinding列表: UIElement ContentElement

当我执行routed命令时,假设:

ApplicationCommands.Undo.Execute(null, this);
WPF使用了一些魔法来找到适当的
命令绑定
,它在该绑定上执行
ExecutedRoutedEventHandler

有没有办法获取要执行的
CommandBinding
(或至少是处理程序)的引用


有时,知道谁在处理命令对调试来说是件好事。

您可以尝试在以下位置查看CommandBinding列表:

       UIElement
       ContentElement 
       UIElement3D

应用程序命令正在内部检查发送方在CommandBinding中是否有特定命令。此外,如果发送方为空,则将Keyboard.FocusedElement指定为发送方。

是,我同意。我尝试进入ApplicationCommand.Undo.Execute的.NET framework源代码(null,此为空);但我只得到了“没有可用的来源”。将尝试清除我的本地符号缓存,然后重试。在调用堆栈中,我对PresentationCore.dll特别感兴趣!System.Windows.Input.CommandManager.FindCommand绑定(对象发送方=…:-)