Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Getting TextInput while also preventing KeyDown and Keyup events from propagating to parent controls

$
0
0

I have a custom WPF control that wants to handle both key down and up events as well as text input. For instance, if the user hits Home on the keyboard, I want to handle that in my custom control and prevent it from bubbling up to other controls.

Now, I can achieve this by handling the key down and up events in my custom control and settingKeyEventArgs.Handled to true. However, this has the unfortunate side effect that text input events then aren't getting generated.

How do I handle both key down and key up events as well as text input without letting the events propagate to parent controls. I want to work pretty much like the TextBox control, which can handle both Home and End without letting the events propagate, while also handling actual text input.


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>