KeyDown event does not occur when applying Style. #3165
-
|
Applying the MaterialDesignToolToggleListBox style to the ListBox does not cause a KeyDown event. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
@Hoeung I suspect the reason you are not able to hit the I believe that is because the toggle style uses a One solution to this, which unfortunately requires a fix in MDIX, would be to add a call to |
Beta Was this translation helpful? Give feedback.
@Hoeung I suspect the reason you are not able to hit the
KeyDown(orPreviewKeyDownfor that matter) event handler is because theListBoxdoes not have focus; even after using the mouse to toggle an item.I believe that is because the toggle style uses a
PreviewMouseLeftButtonDownevent to capture the mouse click (see ListBoxAssist.cs) and manually perform the toggle action. This also marks the event as handled which means theListBoxItemprobably never receives an actualMouseDownevent which would cause theListBox(orListBoxItem) to be focused; this is what happens for a "normal"ListBox.One solution to this, which unfortunately requires a fix in MDIX, would be to add a call to
listB…