Skip to content

Commit c717742

Browse files
committed
Move settings to sidebar
1 parent c3f32cb commit c717742

File tree

4 files changed

+52
-25
lines changed

4 files changed

+52
-25
lines changed

src/Files.App/UserControls/AddressToolbar.xaml

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -620,28 +620,6 @@
620620
Style="{StaticResource App.ThemedIcons.AppUpdatedBox}" />
621621
</Button>
622622

623-
<!-- Open the Settings dialog -->
624-
<Button
625-
x:Name="SettingsButton"
626-
AccessKey="I"
627-
AccessKeyInvoked="Button_AccessKeyInvoked"
628-
AutomationProperties.AutomationId="SettingsButton"
629-
AutomationProperties.Name="{x:Bind ViewModel.Commands.OpenSettings.Label, Mode=OneWay}"
630-
Command="{x:Bind ViewModel.Commands.OpenSettings, Mode=OneWay}"
631-
Style="{StaticResource AddressToolbarButtonStyle}"
632-
ToolTipService.Placement="Bottom"
633-
ToolTipService.ToolTip="{x:Bind ViewModel.Commands.OpenSettings.LabelWithHotKey, Mode=OneWay}"
634-
Visibility="{x:Bind ShowSettingsButton, Mode=OneWay}">
635-
<AnimatedIcon x:Name="SettingAnimatedIcon" Height="16">
636-
<AnimatedIcon.Source>
637-
<animatedvisuals:AnimatedSettingsVisualSource />
638-
</AnimatedIcon.Source>
639-
<AnimatedIcon.FallbackIconSource>
640-
<SymbolIconSource Symbol="Setting" />
641-
</AnimatedIcon.FallbackIconSource>
642-
</AnimatedIcon>
643-
</Button>
644-
645623
</StackPanel>
646624

647625
<!-- Status Center TeachingTip -->

src/Files.App/UserControls/AddressToolbar.xaml.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ namespace Files.App.UserControls
1616
{
1717
[DependencyProperty<bool>("IsSidebarPaneOpenToggleButtonVisible")]
1818
[DependencyProperty<bool>("ShowOngoingTasks")]
19-
[DependencyProperty<bool>("ShowSettingsButton")]
2019
[DependencyProperty<bool>("ShowSearchBox")]
2120
[DependencyProperty<AddressToolbarViewModel>("ViewModel")]
2221
public sealed partial class AddressToolbar : UserControl

src/Files.App/Views/MainPage.xaml

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
xmlns:toolkit="using:CommunityToolkit.WinUI.Controls"
1414
xmlns:uc="using:Files.App.UserControls"
1515
xmlns:viewmodels="using:Files.App.ViewModels"
16-
xmlns:wctconverters="using:CommunityToolkit.WinUI.Converters"
16+
xmlns:wctconverters="using:CommunityToolkit.WinUI.Converters"
17+
xmlns:animatedvisuals="using:Microsoft.UI.Xaml.Controls.AnimatedVisuals"
1718
AllowDrop="True"
1819
Background="{ThemeResource App.Theme.BackgroundBrush}"
1920
DataContext="{x:Bind ViewModel, Mode=OneWay}"
@@ -152,7 +153,6 @@
152153
OngoingTasksViewModel="{x:Bind OngoingTasksViewModel}"
153154
ShowOngoingTasks="True"
154155
ShowSearchBox="True"
155-
ShowSettingsButton="{x:Bind WindowContext.IsCompactOverlay, Mode=OneWay, Converter={StaticResource BoolNegationConverter}}"
156156
TabIndex="1" />
157157

158158
<!-- Content Area -->
@@ -257,6 +257,47 @@
257257
x:Load="{x:Bind ViewModel.ShowShelfPane, Mode=OneWay}" />
258258
</Grid>
259259
</controls:SidebarView.InnerContent>
260+
261+
<controls:SidebarView.Footer>
262+
<StackPanel
263+
Padding="4"
264+
Spacing="4">
265+
<Border HorizontalAlignment="Stretch" Height="1" BorderBrush="{ThemeResource ControlStrokeColorDefaultBrush}" BorderThickness="1"/>
266+
<!-- Open the Settings dialog -->
267+
<Button
268+
x:Name="SettingsButton"
269+
AccessKey="I"
270+
AccessKeyInvoked="SettingsButton_AccessKeyInvoked"
271+
AutomationProperties.AutomationId="SettingsButton"
272+
AutomationProperties.Name="{x:Bind Commands.OpenSettings.Label, Mode=OneWay}"
273+
Command="{x:Bind Commands.OpenSettings, Mode=OneWay}"
274+
Height="32"
275+
HorizontalAlignment="Stretch"
276+
HorizontalContentAlignment="Stretch"
277+
ToolTipService.Placement="Bottom"
278+
ToolTipService.ToolTip="{x:Bind Commands.OpenSettings.LabelWithHotKey, Mode=OneWay}">
279+
<Grid HorizontalAlignment="Stretch">
280+
<Grid.ColumnDefinitions>
281+
<ColumnDefinition Width="Auto" />
282+
<ColumnDefinition Width="*" />
283+
</Grid.ColumnDefinitions>
284+
<AnimatedIcon x:Name="SettingAnimatedIcon" Height="16" Margin="4,0,0,0">
285+
<AnimatedIcon.Source>
286+
<animatedvisuals:AnimatedSettingsVisualSource />
287+
</AnimatedIcon.Source>
288+
<AnimatedIcon.FallbackIconSource>
289+
<SymbolIconSource Symbol="Setting" />
290+
</AnimatedIcon.FallbackIconSource>
291+
</AnimatedIcon>
292+
293+
<TextBlock
294+
Grid.Column="1"
295+
Margin="16,0,0,0"
296+
Text="{x:Bind Commands.OpenSettings.Label, Mode=OneWay}"/>
297+
</Grid>
298+
</Button>
299+
</StackPanel>
300+
</controls:SidebarView.Footer>
260301
</controls:SidebarView>
261302

262303
<VisualStateManager.VisualStateGroups>

src/Files.App/Views/MainPage.xaml.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
using VirtualKey = Windows.System.VirtualKey;
2020
using GridSplitter = Files.App.Controls.GridSplitter;
2121
using Files.App.Controls;
22+
using Microsoft.UI.Xaml.Media;
2223

2324
namespace Files.App.Views
2425
{
@@ -494,5 +495,13 @@ private void PaneSplitter_ManipulationStarted(object sender, ManipulationStarted
494495
this.ChangeCursor(InputSystemCursor.Create(InfoPane.Position == PreviewPanePositions.Right ?
495496
InputSystemCursorShape.SizeWestEast : InputSystemCursorShape.SizeNorthSouth));
496497
}
498+
499+
500+
private void SettingsButton_AccessKeyInvoked(UIElement sender, AccessKeyInvokedEventArgs args)
501+
{
502+
// Suppress access key invocation if any dialog is open
503+
if (VisualTreeHelper.GetOpenPopupsForXamlRoot(MainWindow.Instance.Content.XamlRoot).Any())
504+
args.Handled = true;
505+
}
497506
}
498507
}

0 commit comments

Comments
 (0)