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 39
39
<Setter Property =" HorizontalContentAlignment" Value =" Stretch" />
40
40
<Setter Property =" IsHeaderVisible" Value =" True" />
41
41
<Setter Property =" Padding" Value =" {x:Static wpf:Constants.TextBoxDefaultPadding}" />
42
+ <Setter Property =" Focusable" Value =" False" />
42
43
<Setter Property =" Template" >
43
44
<Setter .Value>
44
45
<ControlTemplate TargetType =" {x:Type wpf:TimePicker}" >
101
102
wpf:TextFieldAssist.UnderlineCornerRadius=" {TemplateBinding wpf:TextFieldAssist.UnderlineCornerRadius}"
102
103
internal:InternalTextFieldAssist.IsMouseOver=" {TemplateBinding IsMouseOver}"
103
104
BorderBrush =" {TemplateBinding BorderBrush}"
104
- Focusable =" {TemplateBinding Focusable}"
105
105
Style =" {DynamicResource NestedTextBoxStyle}" >
106
106
<wpf : TimePickerTextBox .BorderThickness>
107
107
<PriorityBinding >
Original file line number Diff line number Diff line change @@ -371,7 +371,7 @@ private bool ProcessKey(KeyEventArgs keyEventArgs)
371
371
{
372
372
case Key . Down :
373
373
{
374
- if ( ( Keyboard . Modifiers & ModifierKeys . Alt ) == ModifierKeys . Alt )
374
+ if ( Keyboard . Modifiers . HasFlag ( ModifierKeys . Alt ) )
375
375
{
376
376
TogglePopup ( ) ;
377
377
return true ;
Original file line number Diff line number Diff line change @@ -560,7 +560,7 @@ public async Task TimePicker_WithOutlinedStyleAndNoCustomHintBackgroundSet_Shoul
560
560
var timePickerTextBox = await timePicker . GetElement < TimePickerTextBox > ( "/TimePickerTextBox" ) ;
561
561
var hintBackgroundGrid = await timePicker . GetElement < Grid > ( "HintBackgroundGrid" ) ;
562
562
563
- var defaultBackground = Colors . Transparent ;
563
+ var defaultBackground = Colors . Transparent ;
564
564
var defaultFloatedBackground = await GetThemeColor ( "MaterialDesign.Brush.Background" ) ;
565
565
566
566
// Assert (unfocused state)
@@ -643,6 +643,36 @@ public async Task TimePicker_ShouldApplyIsMouseOverTriggers_WhenHoveringTimeButt
643
643
644
644
recorder . Success ( ) ;
645
645
}
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
+ }
646
676
}
647
677
648
678
public class OnlyTenOClockValidationRule : ValidationRule
You can’t perform that action at this time.
0 commit comments