diff --git a/src/Artemis.UI.Shared/Controls/DraggableNumberBox.axaml b/src/Artemis.UI.Shared/Controls/DraggableNumberBox.axaml index 0c571239e..5802bd188 100644 --- a/src/Artemis.UI.Shared/Controls/DraggableNumberBox.axaml +++ b/src/Artemis.UI.Shared/Controls/DraggableNumberBox.axaml @@ -6,25 +6,27 @@ xmlns:sharedControls="clr-namespace:Artemis.UI.Shared.Controls" xmlns:attachedProperties="clr-namespace:Artemis.UI.Shared.AttachedProperties" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" - x:Class="Artemis.UI.Shared.Controls.DraggableNumberBox"> + x:Class="Artemis.UI.Shared.Controls.DraggableNumberBox" + Focusable="True"> - - - - + ().LastOrDefault(); if (e.Key == Key.Enter || e.Key == Key.Escape) - toFocus?.Focus(); + Focus(); } private void OnPointerPressed(object? sender, PointerPressedEventArgs e) @@ -217,9 +216,9 @@ public partial class DraggableNumberBox : UserControl if (!_moved) { // Let our parent take focus, it would make more sense to take focus ourselves but that hides the collider - (Parent as IInputElement)?.Focus(); + PseudoClasses.Add("dragging"); + Focus(); _moved = true; - e.Pointer.Capture(this); DragStarted?.Invoke(this, EventArgs.Empty); } @@ -254,6 +253,7 @@ public partial class DraggableNumberBox : UserControl else { _moved = false; + PseudoClasses.Remove("dragging"); DragFinished?.Invoke(this, EventArgs.Empty); }