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