简体   繁体   English

如何检测何时其他代码设置e.Handled = true?

[英]How To Detect When Other Code Setting e.Handled = true?

Using C#, .NET 4, WPF. 使用C#、. NET 4,WPF。

I have a Telerik rich text control that is losing certain key events (tab, backspace, delete, and the arrow keys are specifics). 我有一个Telerik Rich Text控件,该控件丢失了某些按键事件(选项卡,退格键,删除键和箭头键是特定的)。

For debugging purposes I have added handlers for PreviewKeyDown, KeyDown, CommandExecuting, and DocumentContentChanged. 出于调试目的,我添加了PreviewKeyDown,KeyDown,CommandExecuting和DocumentContentChanged的处理程序。 The behavior presents both with and without the handlers present, in both DEBUG and RELEASE mode. 在DEBUG和RELEASE模式下,无论是否存在处理程序,此行为都会同时出现。

If I press a key other than those listed above I get the events in the order listed above. 如果我按上面列出的以外的其他键,则按照上面列出的顺序获取事件。 As an example, if I press the 'a' key I get PreviewKeyDown, KeyDown, CommandExecuting, and DocumentContentChanged. 例如,如果我按“ a”键,则会得到PreviewKeyDown,KeyDown,CommandExecuting和DocumentContentChanged。

If I press the right arrow key I get PreviewKeyDown and no other of the events fire. 如果按向右箭头键,我将得到PreviewKeyDown,其他事件均不会触发。

My suspicion is that there is something trapping the KeyDown event at some point in the message chain before it gets to me and setting e.Handled = true. 我怀疑的是,也有一些是在消息链中某个点捕捉KeyDown事件它获取到我面前设置e.Handled = TRUE。

Is there any tool available that would allow me to detect the KeyDown event and see in what code it's e.Handled is modified? 有没有可用的工具可以让我检测KeyDown事件并查看其e.Handled的代码已被修改? I know I'm stretching here... 我知道我在这里伸展...

Thanks! 谢谢!

rjsjr js

You could use Snoop . 您可以使用Snoop It can tell you, which Element set handled = true. 它可以告诉您哪个元素集处理= true。 If you need to process these events, you can use EventManager.RegisterClassHandler() . 如果需要处理这些事件,则可以使用EventManager.RegisterClassHandler()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM