How can a control recieve keyboard events? #19497
-
|
Does a control recieve key events only when it is focused? I found i can't focus a control(no :focus-within class) by mouse click. The only way i can focus is to use a TextBox. Then i found i can't make it lose focus |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Controls without input focus often require setting Removing focus is harder. You're supposed to focus an alternate element instead which feels pretty awkward to me. You can still get the Avalonia/src/Avalonia.Base/Input/IFocusManager.cs Lines 19 to 20 in f56babb |
Beta Was this translation helpful? Give feedback.
Controls without input focus often require setting
Focusable="True"on them to make them eligible for focus. You can diagnose this using DevTools.Removing focus is harder. You're supposed to focus an alternate element instead which feels pretty awkward to me. You can still get the
FocusManagerfrom a TopLevel and call ClearFocus for now...but not sure if that's going away:Avalonia/src/Avalonia.Base/Input/IFocusManager.cs
Lines 19 to 20 in f56babb