File tree Expand file tree Collapse file tree 8 files changed +35
-25
lines changed
tests/Files.App.UITests/Views Expand file tree Collapse file tree 8 files changed +35
-25
lines changed Original file line number Diff line number Diff line change @@ -16,5 +16,8 @@ public partial class Omnibar
1616 {
1717 [ GeneratedDependencyProperty ]
1818 public partial IList < OmnibarMode > ? Modes { get ; set ; }
19+
20+ [ GeneratedDependencyProperty ]
21+ public partial OmnibarMode ? CurrentActiveMode { get ; set ; }
1922 }
2023}
Original file line number Diff line number Diff line change @@ -93,8 +93,11 @@ internal void ChangeExpandedMode(OmnibarMode modeToExpand)
9393 VisualStateManager . GoToState ( mode , "Collapsed" , true ) ;
9494
9595 // Expand the given mode
96+ VisualStateManager . GoToState ( modeToExpand , "Focused" , true ) ;
9697 VisualStateManager . GoToState ( modeToExpand , "Visible" , true ) ;
9798 _modesHostGrid . ColumnDefinitions [ _modesHostGrid . Children . IndexOf ( modeToExpand ) ] . Width = new ( 1 , GridUnitType . Star ) ;
99+
100+ CurrentActiveMode = modeToExpand ;
98101 }
99102
100103 private void UpdateVisualStates ( )
Original file line number Diff line number Diff line change @@ -41,12 +41,6 @@ public partial class OmnibarMode
4141 [ GeneratedDependencyProperty ]
4242 internal partial bool IsHostFocused { get ; set ; }
4343
44- //partial void OnHostChanged(Grid? newValue)
45- //{
46- // if (_isHostInitialized)
47- // throw new InvalidOperationException("Host is already set and cannot be changed again.");
48- //}
49-
5044 partial void OnIsHostFocusedChanged ( bool newValue )
5145 {
5246 UpdateVisualStates ( ) ;
Original file line number Diff line number Diff line change @@ -12,8 +12,14 @@ namespace Files.App.Controls
1212{
1313 // Template parts
1414 [ TemplatePart ( Name = "PART_ModeClickBorder" , Type = typeof ( Border ) ) ]
15+ [ TemplatePart ( Name = "PART_ModeIconPresenter" , Type = typeof ( ContentPresenter ) ) ]
1516 [ TemplatePart ( Name = "PART_InputTextBox" , Type = typeof ( TextBox ) ) ]
1617 // Visual states
18+ [ TemplateVisualState ( Name = "PointerNormal" , GroupName = "CommonStates" ) ]
19+ [ TemplateVisualState ( Name = "PointerOver" , GroupName = "CommonStates" ) ]
20+ [ TemplateVisualState ( Name = "PointerPressed" , GroupName = "CommonStates" ) ]
21+ [ TemplateVisualState ( Name = "Focused" , GroupName = "CommonStates" ) ]
22+ // Visual states
1723 [ TemplateVisualState ( Name = "Collapsed" , GroupName = "InputVisibilityStates" ) ]
1824 [ TemplateVisualState ( Name = "Visible" , GroupName = "InputVisibilityStates" ) ]
1925 public partial class OmnibarMode : Control
Original file line number Diff line number Diff line change 3838 <BrushTransition Duration =" 0:0:0.083" />
3939 </Border .BackgroundTransition>
4040
41- <ContentPresenter HorizontalAlignment =" Center" Content =" {TemplateBinding IconOnInactive}" />
41+ <ContentPresenter
42+ x:Name=" PART_ModeIconPresenter"
43+ HorizontalAlignment=" Center"
44+ VerticalAlignment=" Center"
45+ Content=" {TemplateBinding IconOnInactive}" />
4246 </Border >
4347
4448 <TextBox
7882 <Setter Target =" PART_ModeClickBorder.Background" Value =" {ThemeResource SubtleFillColorSecondaryBrush}" />
7983 </VisualState .Setters>
8084 </VisualState >
85+ <VisualState x : Name =" Focused" >
86+ <VisualState .Setters>
87+ <Setter Target =" PART_ModeIconPresenter.Content" Value =" {TemplateBinding IconOnActive}" />
88+ </VisualState .Setters>
89+ </VisualState >
8190 </VisualStateGroup >
8291
8392 <VisualStateGroup x : Name =" InputVisibilityStates" >
Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ protected virtual void OnIconColorTypePropertyChanged(ThemedIconColorType oldVal
4848 protected virtual void OnIconSizePropertyChanged ( double oldValue , double newValue )
4949 {
5050 UpdateVisualStates ( ) ;
51+ OnIconSizeChanged ( ) ;
5152 }
5253
5354 protected virtual void OnIsToggledPropertyChanged ( bool oldValue , bool newValue )
Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ protected override void OnApplyTemplate()
4343
4444 OnIconTypeChanged ( ) ;
4545 OnIconColorTypeChanged ( ) ;
46+ OnIconSizeChanged ( ) ;
4647 }
4748
4849 private void GetTemplateParts ( )
@@ -249,5 +250,10 @@ private void OnIconColorChanged()
249250 if ( GetTemplateChild ( FilledIconPath ) is Path fillPath )
250251 fillPath . Fill = ( Brush ) this . GetValue ( ColorProperty ) ;
251252 }
253+
254+ private void OnIconSizeChanged ( )
255+ {
256+ Height = Width = IconSize ;
257+ }
252258 }
253259}
Original file line number Diff line number Diff line change 7171 TextPlaceholder=" Enter text..." >
7272 <controls : OmnibarMode .IconOnActive>
7373 <controls : ThemedIcon
74- Width=" 16"
75- Height=" 16"
74+ IconColorType=" Normal"
7675 IsFilled=" True"
7776 Style=" {StaticResource App.ThemedIcons.Omnibar.Path}" />
7877 </controls : OmnibarMode .IconOnActive>
7978 <controls : OmnibarMode .IconOnInactive>
80- <controls : ThemedIcon
81- Width=" 16"
82- Height=" 16"
83- Style=" {StaticResource App.ThemedIcons.Omnibar.Path}" />
79+ <controls : ThemedIcon IconColorType =" Normal" Style =" {StaticResource App.ThemedIcons.Omnibar.Path}" />
8480 </controls : OmnibarMode .IconOnInactive>
8581 </controls : OmnibarMode >
8682 <controls : OmnibarMode
8985 TextPlaceholder=" Enter a palette command..." >
9086 <controls : OmnibarMode .IconOnActive>
9187 <controls : ThemedIcon
92- Width=" 16"
93- Height=" 16"
88+ IconColorType=" Normal"
9489 IsFilled=" True"
9590 Style=" {StaticResource App.ThemedIcons.Omnibar.Commands}" />
9691 </controls : OmnibarMode .IconOnActive>
9792 <controls : OmnibarMode .IconOnInactive>
98- <controls : ThemedIcon
99- Width=" 16"
100- Height=" 16"
101- Style=" {StaticResource App.ThemedIcons.Omnibar.Commands}" />
93+ <controls : ThemedIcon IconColorType =" Normal" Style =" {StaticResource App.ThemedIcons.Omnibar.Commands}" />
10294 </controls : OmnibarMode .IconOnInactive>
10395 </controls : OmnibarMode >
10496 <controls : OmnibarMode Text =" Search..." TextPlaceholder =" Enter a search query..." >
10597 <controls : OmnibarMode .IconOnActive>
10698 <controls : ThemedIcon
107- Width=" 16"
108- Height=" 16"
99+ IconColorType=" Normal"
109100 IsFilled=" True"
110101 Style=" {StaticResource App.ThemedIcons.Omnibar.Search}" />
111102 </controls : OmnibarMode .IconOnActive>
112103 <controls : OmnibarMode .IconOnInactive>
113- <controls : ThemedIcon
114- Width=" 16"
115- Height=" 16"
116- Style=" {StaticResource App.ThemedIcons.Omnibar.Search}" />
104+ <controls : ThemedIcon IconColorType =" Normal" Style =" {StaticResource App.ThemedIcons.Omnibar.Search}" />
117105 </controls : OmnibarMode .IconOnInactive>
118106 </controls : OmnibarMode >
119107 </controls : Omnibar >
You can’t perform that action at this time.
0 commit comments