diff --git a/src/Ursa/Controls/DateTimePicker/TimePicker.cs b/src/Ursa/Controls/DateTimePicker/TimePicker.cs index 0a7ac7b..ef40cc9 100644 --- a/src/Ursa/Controls/DateTimePicker/TimePicker.cs +++ b/src/Ursa/Controls/DateTimePicker/TimePicker.cs @@ -63,10 +63,8 @@ public class TimePicker : TemplatedControl, IClearControl, IInnerContentControl, nameof(IsReadonly)); private Button? _button; - private Popup? _popup; private TimePickerPresenter? _presenter; - private TextBox? _textBox; @@ -185,6 +183,29 @@ public class TimePicker : TemplatedControl, IClearControl, IInnerContentControl, IsDropdownOpen = true; } + protected override void OnKeyDown(KeyEventArgs e) + { + if (e.Key == Key.Escape) + { + SetCurrentValue(IsDropdownOpenProperty, false); + e.Handled = true; + return; + } + if (e.Key == Key.Down) + { + SetCurrentValue(IsDropdownOpenProperty, true); + e.Handled = true; + return; + } + + if (e.Key == Key.Tab) + { + SetCurrentValue(IsDropdownOpenProperty, false); + return; + } + base.OnKeyDown(e); + } + private void OnTextChanged(object? sender, TextChangedEventArgs e) {