Closed
Description
Describe the bug
Registration of hotkeys for controls that do not implement Avalonia.Input.IClickableControl
is not possible.
To Reproduce
Example with working hotkey registration for custom type HotKeyedTextBox
inherited from Avalonia.Controls.TextBox
for Avalonia v0.10.21 and not working hotkey registration for custom type HotKeyedTextBox
inherited from Avalonia.Controls.TextBox for Avalonia V11 here.
But in general:
- Create custom control which not implementing
Avalonia.Controls.TextBox
or not inherits fromAvalonia.Controls
types which implementsAvalonia.Input.IClickableControl
(examples: Window, UserControl, TextBox, TextBlock, PathIcon, ListBox, etc). - Implement
HotKeyProperty
andHotKey
likeAvalonia.Controls.Buttons
- Implement
ICommandSource
where inCommand
will be your hotkey logic (implementation ofAvalonia.Input.IClickableControl
not possible due protection level).
Expected behavior
Hotkey working.
Screenshots
Below reproduction using samples from here.
https://github.com/AvaloniaUI/Avalonia/assets/44833369/2423270f-8b14-4a4d-aac2-968a20d2f250
Desktop:
- OS: Windows
- Version: 0.10.21 and 11.0.0
Additional context
PR that broke the working functionality is #7500