1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Ui - Fixed every hotkey in the same tree receiving input

This commit is contained in:
Diogo Trindade 2023-04-10 10:36:24 +01:00
parent 0107bfdd24
commit 1f0ec791cf

View File

@ -36,16 +36,20 @@ public class HotkeyBox : UserControl
UpdateDisplayTextBox(); UpdateDisplayTextBox();
} }
protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e) protected override void OnGotFocus(GotFocusEventArgs e)
{ {
_inputService.KeyboardKeyDown += InputServiceOnKeyboardKeyDown; _inputService.KeyboardKeyDown += InputServiceOnKeyboardKeyDown;
_inputService.KeyboardKeyUp += InputServiceOnKeyboardKeyUp; _inputService.KeyboardKeyUp += InputServiceOnKeyboardKeyUp;
base.OnGotFocus(e);
} }
protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e) protected override void OnLostFocus(RoutedEventArgs e)
{ {
_inputService.KeyboardKeyDown -= InputServiceOnKeyboardKeyDown; _inputService.KeyboardKeyDown -= InputServiceOnKeyboardKeyDown;
_inputService.KeyboardKeyUp -= InputServiceOnKeyboardKeyUp; _inputService.KeyboardKeyUp -= InputServiceOnKeyboardKeyUp;
base.OnLostFocus(e);
} }
private static void HotkeyChanging(IAvaloniaObject sender, bool before) private static void HotkeyChanging(IAvaloniaObject sender, bool before)