简体   繁体   中英

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

Using 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).

For debugging purposes I have added handlers for PreviewKeyDown, KeyDown, CommandExecuting, and DocumentContentChanged. The behavior presents both with and without the handlers present, in both DEBUG and RELEASE mode.

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.

If I press the right arrow key I get PreviewKeyDown and no other of the events fire.

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.

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? I know I'm stretching here...

Thanks!

rjsjr

You could use Snoop . It can tell you, which Element set handled = true. If you need to process these events, you can use EventManager.RegisterClassHandler() .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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