Ui - Fixed every hotkey in the same tree receiving input

This commit is contained in:
Diogo Trindade committed 2023-04-10 10:36:24 +01:00
1 parent 0107bfdd24
commit 1f0ec791cf
1 file changed
+6 -2
@@ -36,16 +36,20 @@ public class HotkeyBox : UserControl
UpdateDisplayTextBox();
}
protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
protected override void OnGotFocus(GotFocusEventArgs e)
{
_inputService.KeyboardKeyDown += InputServiceOnKeyboardKeyDown;
_inputService.KeyboardKeyUp += InputServiceOnKeyboardKeyUp;
base.OnGotFocus(e);
}
protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e)
protected override void OnLostFocus(RoutedEventArgs e)
{
_inputService.KeyboardKeyDown -= InputServiceOnKeyboardKeyDown;
_inputService.KeyboardKeyUp -= InputServiceOnKeyboardKeyUp;
base.OnLostFocus(e);
}
private static void HotkeyChanging(IAvaloniaObject sender, bool before)