-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Description
I work on some Interaction Detection and use the fact that Controls mark RoutedEvents as Handled when they handle them.
Unfortunately, TextBoxes only mark TextCompositionEventArgs in the OnTextInput method and ExecutedRoutedEventArgs in the OnSpace as Handled (see TextEditorTyping.cs#L386). All other Events (Delete, Key Events, ...) that are also implemented in TextEditorTyping are not marked as handled. Is there a Reason for that? It is a problem for my usecase.
Reproduction Steps
Register a ClassHandler for handled Events and debug what Controls handle the events.
KeyEventHandler keyEventHandler = /* please ask for the implementation if its necessary */
EventManager.RegisterClassHandler(typeof(UIElement), UIElement.PreviewKeyDownEvent, keyEventHandler, true);
EventManager.RegisterClassHandler(typeof(UIElement), UIElement.KeyDownEvent, keyEventHandler, true);
EventManager.RegisterClassHandler(typeof(UIElement), UIElement.PreviewKeyUpEvent, keyEventHandler, true);
EventManager.RegisterClassHandler(typeof(UIElement), UIElement.KeyUpEvent, keyEventHandler, true);
Expected behavior
TextBoxes handle all Events that change its text.
Actual behavior
TextBoxes only mark TextCompositionEventArgs in the OnTestInput method and ExecutedRoutedEventArgs in the OnSpace as Handled.
All common KeyEvents do not mark events as Handled, as well as all other event handling methods OnBackspace, OnDelete, OnToggleInsert, ...
Regression?
No response
Known Workarounds
No response
Impact
No response
Configuration
Not configuration specific as far as I know, but the target framework is net80-windows
Other information
No response