Skip to content

Commit 5b77618

Browse files
authored
Code Quality: Updated status bar flyout with Segmented Control (#17060)
1 parent d983bd1 commit 5b77618

File tree

1 file changed

+14
-94
lines changed

1 file changed

+14
-94
lines changed

Diff for: src/Files.App/UserControls/StatusBar.xaml

+14-94
Original file line numberDiff line numberDiff line change
@@ -9,97 +9,20 @@
99
xmlns:data="using:Files.App.Data.Items"
1010
xmlns:helpers="using:Files.App.Helpers"
1111
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
12+
xmlns:toolkit="using:CommunityToolkit.WinUI.Controls"
1213
xmlns:usercontrols="using:Files.App.UserControls"
1314
DataContext="{x:Bind StatusBarViewModel, Mode=OneWay}"
1415
mc:Ignorable="d">
1516

1617
<UserControl.Resources>
17-
<converters:NullToTrueConverter x:Key="NullToFalseConverter" Inverse="True" />
18-
<converters:NullToVisibilityCollapsedConverter x:Key="NullToVisibilityCollapsedConverter" />
18+
<ResourceDictionary>
19+
<ResourceDictionary.MergedDictionaries>
20+
<ResourceDictionary Source="ms-appx:///CommunityToolkit.WinUI.Controls.Segmented/Segmented/Segmented.xaml" />
21+
</ResourceDictionary.MergedDictionaries>
1922

20-
<Style x:Key="Local.RadioButtonStyle" TargetType="RadioButton">
21-
<Setter Property="Foreground" Value="{ThemeResource TextFillColorSecondaryBrush}" />
22-
<Setter Property="BorderBrush" Value="{ThemeResource RadioButtonBorderBrush}" />
23-
<Setter Property="HorizontalAlignment" Value="Left" />
24-
<Setter Property="VerticalAlignment" Value="Center" />
25-
<Setter Property="HorizontalContentAlignment" Value="Left" />
26-
<Setter Property="VerticalContentAlignment" Value="Top" />
27-
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" />
28-
<Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}" />
29-
<Setter Property="MinWidth" Value="0" />
30-
<Setter Property="UseSystemFocusVisuals" Value="{StaticResource UseSystemFocusVisuals}" />
31-
<Setter Property="Template">
32-
<Setter.Value>
33-
<ControlTemplate TargetType="RadioButton">
34-
<Grid x:Name="RootGrid" Margin="0">
35-
<Grid.RowDefinitions>
36-
<RowDefinition Height="Auto" />
37-
<RowDefinition Height="4" />
38-
</Grid.RowDefinitions>
39-
<ContentPresenter
40-
x:Name="ContentPresenter"
41-
Grid.Row="0"
42-
Padding="12,4,12,4"
43-
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
44-
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
45-
AutomationProperties.AccessibilityView="Raw"
46-
Content="{TemplateBinding Content}"
47-
ContentTemplate="{TemplateBinding ContentTemplate}"
48-
ContentTransitions="{TemplateBinding ContentTransitions}"
49-
Foreground="{TemplateBinding Foreground}"
50-
TextWrapping="Wrap" />
51-
<Border
52-
x:Name="SelectionPill"
53-
Grid.Row="1"
54-
Height="2"
55-
Margin="16,0,16,0"
56-
Background="Transparent"
57-
CornerRadius="2" />
58-
<VisualStateManager.VisualStateGroups>
59-
<VisualStateGroup x:Name="CommonStates">
60-
<VisualState x:Name="Normal" />
61-
<VisualState x:Name="PointerOver">
62-
<Storyboard>
63-
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
64-
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextFillColorPrimaryBrush}" />
65-
</ObjectAnimationUsingKeyFrames>
66-
</Storyboard>
67-
</VisualState>
68-
<VisualState x:Name="Pressed">
69-
<Storyboard>
70-
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
71-
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextFillColorPrimaryBrush}" />
72-
</ObjectAnimationUsingKeyFrames>
73-
</Storyboard>
74-
</VisualState>
75-
<VisualState x:Name="Disabled">
76-
<Storyboard>
77-
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
78-
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextFillColorDisabledBrush}" />
79-
</ObjectAnimationUsingKeyFrames>
80-
</Storyboard>
81-
</VisualState>
82-
</VisualStateGroup>
83-
<VisualStateGroup x:Name="CheckStates">
84-
<VisualState x:Name="Checked">
85-
<Storyboard>
86-
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="SelectionPill" Storyboard.TargetProperty="Background">
87-
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemAccentColor}" />
88-
</ObjectAnimationUsingKeyFrames>
89-
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
90-
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextFillColorPrimaryBrush}" />
91-
</ObjectAnimationUsingKeyFrames>
92-
</Storyboard>
93-
</VisualState>
94-
<VisualState x:Name="Unchecked" />
95-
<VisualState x:Name="Indeterminate" />
96-
</VisualStateGroup>
97-
</VisualStateManager.VisualStateGroups>
98-
</Grid>
99-
</ControlTemplate>
100-
</Setter.Value>
101-
</Setter>
102-
</Style>
23+
<converters:NullToTrueConverter x:Key="NullToFalseConverter" Inverse="True" />
24+
<converters:NullToVisibilityCollapsedConverter x:Key="NullToVisibilityCollapsedConverter" />
25+
</ResourceDictionary>
10326
</UserControl.Resources>
10427

10528
<Grid Padding="8,0,0,0">
@@ -317,17 +240,14 @@
317240
BorderThickness="0,0,0,1">
318241

319242
<!-- Locals and Remotes -->
320-
<StackPanel
243+
<toolkit:Segmented
321244
Grid.Row="1"
322245
HorizontalAlignment="Left"
323-
VerticalAlignment="Center"
324-
Orientation="Horizontal">
325-
<RadioButton
326-
Content="{helpers:ResourceString Name=Locals}"
327-
IsChecked="{x:Bind StatusBarViewModel.ShowLocals, Mode=TwoWay}"
328-
Style="{StaticResource Local.RadioButtonStyle}" />
329-
<RadioButton Content="{helpers:ResourceString Name=Remotes}" Style="{StaticResource Local.RadioButtonStyle}" />
330-
</StackPanel>
246+
SelectedIndex="0"
247+
Style="{StaticResource PivotSegmentedStyle}">
248+
<toolkit:SegmentedItem Content="{helpers:ResourceString Name=Locals}" IsSelected="{x:Bind StatusBarViewModel.ShowLocals, Mode=TwoWay}" />
249+
<toolkit:SegmentedItem Content="{helpers:ResourceString Name=Remotes}" />
250+
</toolkit:Segmented>
331251

332252
<!-- New Branch Button -->
333253
<Button

0 commit comments

Comments
 (0)