File tree Expand file tree Collapse file tree 3 files changed +33
-3
lines changed
src/MaterialDesignThemes.Wpf
tests/MaterialDesignThemes.UITests/WPF/TimePickers Expand file tree Collapse file tree 3 files changed +33
-3
lines changed Original file line number Diff line number Diff line change 3939 <Setter Property =" HorizontalContentAlignment" Value =" Stretch" />
4040 <Setter Property =" IsHeaderVisible" Value =" True" />
4141 <Setter Property =" Padding" Value =" {x:Static wpf:Constants.TextBoxDefaultPadding}" />
42+ <Setter Property =" Focusable" Value =" False" />
4243 <Setter Property =" Template" >
4344 <Setter .Value>
4445 <ControlTemplate TargetType =" {x:Type wpf:TimePicker}" >
101102 wpf:TextFieldAssist.UnderlineCornerRadius=" {TemplateBinding wpf:TextFieldAssist.UnderlineCornerRadius}"
102103 internal:InternalTextFieldAssist.IsMouseOver=" {TemplateBinding IsMouseOver}"
103104 BorderBrush =" {TemplateBinding BorderBrush}"
104- Focusable =" {TemplateBinding Focusable}"
105105 Style =" {DynamicResource NestedTextBoxStyle}" >
106106 <wpf : TimePickerTextBox .BorderThickness>
107107 <PriorityBinding >
Original file line number Diff line number Diff line change @@ -371,7 +371,7 @@ private bool ProcessKey(KeyEventArgs keyEventArgs)
371371 {
372372 case Key . Down :
373373 {
374- if ( ( Keyboard . Modifiers & ModifierKeys . Alt ) == ModifierKeys . Alt )
374+ if ( Keyboard . Modifiers . HasFlag ( ModifierKeys . Alt ) )
375375 {
376376 TogglePopup ( ) ;
377377 return true ;
Original file line number Diff line number Diff line change @@ -560,7 +560,7 @@ public async Task TimePicker_WithOutlinedStyleAndNoCustomHintBackgroundSet_Shoul
560560 var timePickerTextBox = await timePicker . GetElement < TimePickerTextBox > ( "/TimePickerTextBox" ) ;
561561 var hintBackgroundGrid = await timePicker . GetElement < Grid > ( "HintBackgroundGrid" ) ;
562562
563- var defaultBackground = Colors . Transparent ;
563+ var defaultBackground = Colors . Transparent ;
564564 var defaultFloatedBackground = await GetThemeColor ( "MaterialDesign.Brush.Background" ) ;
565565
566566 // Assert (unfocused state)
@@ -643,6 +643,36 @@ public async Task TimePicker_ShouldApplyIsMouseOverTriggers_WhenHoveringTimeButt
643643
644644 recorder . Success ( ) ;
645645 }
646+
647+ [ Fact ]
648+ [ Description ( "Issue 3650" ) ]
649+ public async Task TimePicker_MovesFocusToPrevious_WhenShiftAndTabIsPressed ( )
650+ {
651+ await using var recorder = new TestRecorder ( App ) ;
652+
653+ // Arrange
654+ var stackPanel = await LoadXaml < StackPanel > ( """
655+ <StackPanel>
656+ <TextBox />
657+ <materialDesign:TimePicker />
658+ </StackPanel>
659+ """ ) ;
660+
661+ var textBox = await stackPanel . GetElement < TextBox > ( "/TextBox" ) ;
662+ var timePickerTextBox = await stackPanel . GetElement < TimePickerTextBox > ( "/TimePickerTextBox" ) ;
663+
664+ // Act
665+ await timePickerTextBox . MoveKeyboardFocus ( ) ;
666+ await Task . Delay ( 50 ) ;
667+ await timePickerTextBox . SendInput ( new KeyboardInput ( Key . LeftShift , Key . Tab ) ) ;
668+ await Task . Delay ( 50 ) ;
669+
670+ // Assert
671+ Assert . True ( await textBox . GetIsFocused ( ) ) ;
672+ Assert . False ( await timePickerTextBox . GetIsFocused ( ) ) ;
673+
674+ recorder . Success ( ) ;
675+ }
646676}
647677
648678public class OnlyTenOClockValidationRule : ValidationRule
You can’t perform that action at this time.
0 commit comments