Skip to content

Commit c5edd15

Browse files
committed
Updated section
1 parent a0fece5 commit c5edd15

11 files changed

+288
-10
lines changed

Diff for: src/Files.App.Controls/Sidebar/SidebarView.Properties.cs

+8
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ public UIElement InnerContent
2121
public static readonly DependencyProperty InnerContentProperty =
2222
DependencyProperty.Register(nameof(InnerContent), typeof(UIElement), typeof(SidebarView), new PropertyMetadata(null));
2323

24+
public UIElement SidebarContent
25+
{
26+
get { return (UIElement)GetValue(SidebarContentProperty); }
27+
set { SetValue(SidebarContentProperty, value); }
28+
}
29+
public static readonly DependencyProperty SidebarContentProperty =
30+
DependencyProperty.Register("SidebarContent", typeof(UIElement), typeof(SidebarView), new PropertyMetadata(null));
31+
2432
public UIElement Footer
2533
{
2634
get { return (UIElement)GetValue(FooterProperty); }

Diff for: src/Files.App.Controls/Sidebar/SidebarView.xaml

+9
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,15 @@
5757
<CompositeTransform x:Name="PaneColumnGridTransform" />
5858
</Grid.RenderTransform>
5959

60+
<!-- Content -->
61+
<ContentPresenter
62+
Grid.RowSpan="2"
63+
HorizontalAlignment="Stretch"
64+
VerticalAlignment="Stretch"
65+
HorizontalContentAlignment="Stretch"
66+
VerticalContentAlignment="Stretch"
67+
Content="{x:Bind SidebarContent, Mode=OneWay}" />
68+
6069
<!-- Menu Items -->
6170
<ItemsRepeaterScrollHost HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
6271
<ScrollViewer
Loading
Loading
Loading
Loading
Loading
Loading

Diff for: src/Files.App/Strings/en-US/Resources.resw

+1-4
Original file line numberDiff line numberDiff line change
@@ -4193,10 +4193,7 @@
41934193
<data name="EnableOmnibar" xml:space="preserve">
41944194
<value>Enable Omnibar</value>
41954195
</data>
4196-
<data name="SectionsHidden" xml:space="preserve">
4197-
<value>Sections hidden</value>
4198-
</data>
41994196
<data name="SectionsHiddenMessage" xml:space="preserve">
4200-
<value>You can add the sections back by right-clicking the sidebar area and selecting the sections you want to add.</value>
4197+
<value>You can add sections to the sidebar by right-clicking and selecting the sections you want to add.</value>
42014198
</data>
42024199
</root>

Diff for: src/Files.App/Views/MainPage.xaml

+85-6
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,24 @@
3131
<ResourceDictionary Source="ms-appx:///Styles/DefaultGridSplitterStyle.xaml" />
3232
</ResourceDictionary.MergedDictionaries>
3333

34+
<ResourceDictionary.ThemeDictionaries>
35+
<ResourceDictionary x:Key="Light">
36+
<ImageSource x:Key="EmptySidebar.48">ms-appx:///Assets/Sidebar/EmptySidebar_48_ThemeLight.svg</ImageSource>
37+
<ImageSource x:Key="EmptySidebar.100">ms-appx:///Assets/Sidebar/EmptySidebar_100_ThemeLight.svg</ImageSource>
38+
<ImageSource x:Key="EmptySidebar.200">ms-appx:///Assets/Sidebar/EmptySidebar_200_ThemeLight.svg</ImageSource>
39+
</ResourceDictionary>
40+
<ResourceDictionary x:Key="Dark">
41+
<ImageSource x:Key="EmptySidebar.48">ms-appx:///Assets/Sidebar/EmptySidebar_48_ThemeDark.svg</ImageSource>
42+
<ImageSource x:Key="EmptySidebar.100">ms-appx:///Assets/Sidebar/EmptySidebar_100_ThemeDark.svg</ImageSource>
43+
<ImageSource x:Key="EmptySidebar.200">ms-appx:///Assets/Sidebar/EmptySidebar_200_ThemeDark.svg</ImageSource>
44+
</ResourceDictionary>
45+
<ResourceDictionary x:Key="HighContrast">
46+
<ImageSource x:Key="EmptySidebar.48">ms-appx:///Assets/Sidebar/EmptySidebar_48_ThemeDark.svg</ImageSource>
47+
<ImageSource x:Key="EmptySidebar.100">ms-appx:///Assets/Sidebar/EmptySidebar_100_ThemeDark.svg</ImageSource>
48+
<ImageSource x:Key="EmptySidebar.200">ms-appx:///Assets/Sidebar/EmptySidebar_200_ThemeDark.svg</ImageSource>
49+
</ResourceDictionary>
50+
</ResourceDictionary.ThemeDictionaries>
51+
3452
<x:Boolean x:Key="True">True</x:Boolean>
3553
<x:Boolean x:Key="False">False</x:Boolean>
3654

@@ -259,14 +277,34 @@
259277
</Grid>
260278
</controls:SidebarView.InnerContent>
261279

280+
<!-- Sidebar Content -->
281+
<controls:SidebarView.SidebarContent>
282+
<StackPanel
283+
x:Name="SidebarContent"
284+
Padding="16,0,16,0"
285+
VerticalAlignment="Center"
286+
Orientation="Vertical"
287+
Spacing="16"
288+
Visibility="{x:Bind SidebarAdaptiveViewModel.AreSectionsHidden, Mode=OneWay}">
289+
290+
<Image
291+
x:Name="EmptySidebarImage"
292+
MaxHeight="48"
293+
Source="{ThemeResource EmptySidebar.48}" />
294+
295+
<TextBlock
296+
MaxWidth="240"
297+
Foreground="{ThemeResource TextFillColorTertiaryBrush}"
298+
Style="{StaticResource App.Theme.CaptionTextBlockStyle}"
299+
Text="{helpers:ResourceString Name=SectionsHiddenMessage}"
300+
TextAlignment="Center" />
301+
302+
</StackPanel>
303+
</controls:SidebarView.SidebarContent>
304+
305+
<!-- Footer -->
262306
<controls:SidebarView.Footer>
263307
<StackPanel Padding="4" Spacing="4">
264-
<InfoBar
265-
Title="{helpers:ResourceString Name=SectionsHidden}"
266-
IsClosable="False"
267-
IsOpen="{x:Bind SidebarAdaptiveViewModel.AreSectionsHidden, Mode=OneWay}"
268-
Message="{helpers:ResourceString Name=SectionsHiddenMessage}" />
269-
270308
<Border
271309
Height="1"
272310
HorizontalAlignment="Stretch"
@@ -328,6 +366,46 @@
328366
</controls:SidebarView>
329367

330368
<VisualStateManager.VisualStateGroups>
369+
<VisualStateGroup x:Name="SidebarWidthStates">
370+
<VisualState x:Name="SmallSidebarWidthState">
371+
<VisualState.Setters>
372+
<Setter Target="EmptySidebarImage.MaxHeight" Value="48" />
373+
<Setter Target="EmptySidebarImage.Source" Value="{ThemeResource EmptySidebar.48}" />
374+
</VisualState.Setters>
375+
</VisualState>
376+
<VisualState x:Name="MediumSidebarWidthState">
377+
<VisualState.Setters>
378+
<Setter Target="EmptySidebarImage.MaxHeight" Value="100" />
379+
<Setter Target="EmptySidebarImage.Source" Value="{ThemeResource EmptySidebar.100}" />
380+
</VisualState.Setters>
381+
</VisualState>
382+
<VisualState x:Name="LargeSidebarWidthState">
383+
<VisualState.Setters>
384+
<Setter Target="EmptySidebarImage.MaxHeight" Value="200" />
385+
<Setter Target="EmptySidebarImage.Source" Value="{ThemeResource EmptySidebar.200}" />
386+
</VisualState.Setters>
387+
</VisualState>
388+
</VisualStateGroup>
389+
390+
<VisualStateGroup x:Name="WindowHeightStates">
391+
<VisualState>
392+
<VisualState.StateTriggers>
393+
<AdaptiveTrigger x:Name="SmallHeightAdaptiveTrigger" MinWindowHeight="440" />
394+
</VisualState.StateTriggers>
395+
<VisualState.Setters>
396+
<Setter Target="EmptySidebarImage.Visibility" Value="Visible" />
397+
</VisualState.Setters>
398+
</VisualState>
399+
<VisualState>
400+
<VisualState.StateTriggers>
401+
<AdaptiveTrigger x:Name="MediumHeightAdaptiveTrigger" MinWindowHeight="0" />
402+
</VisualState.StateTriggers>
403+
<VisualState.Setters>
404+
<Setter Target="EmptySidebarImage.Visibility" Value="Collapsed" />
405+
</VisualState.Setters>
406+
</VisualState>
407+
</VisualStateGroup>
408+
331409
<VisualStateGroup>
332410
<VisualState>
333411
<VisualState.StateTriggers>
@@ -343,6 +421,7 @@
343421
</VisualState.Setters>
344422
</VisualState>
345423
</VisualStateGroup>
424+
346425
<VisualStateGroup>
347426
<VisualState x:Name="NormalSidebarState">
348427
<VisualState.StateTriggers>

Diff for: src/Files.App/Views/MainPage.xaml.cs

+15
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ public MainPage()
5555
_updateDateDisplayTimer = DispatcherQueue.CreateTimer();
5656
_updateDateDisplayTimer.Interval = TimeSpan.FromSeconds(1);
5757
_updateDateDisplayTimer.Tick += UpdateDateDisplayTimer_Tick;
58+
59+
ApplySidebarWidthState();
5860
}
5961

6062
private async Task PromptForReviewAsync()
@@ -120,6 +122,9 @@ private void UserSettingsService_OnSettingChangedEvent(object? sender, SettingCh
120122
case nameof(IInfoPaneSettingsService.IsInfoPaneEnabled):
121123
LoadPaneChanged();
122124
break;
125+
case nameof(IAppearanceSettingsService.SidebarWidth):
126+
ApplySidebarWidthState();
127+
break;
123128
}
124129
}
125130

@@ -434,6 +439,16 @@ private void PaneSplitter_ManipulationCompleted(object sender, ManipulationCompl
434439
this.ChangeCursor(InputSystemCursor.Create(InputSystemCursorShape.Arrow));
435440
}
436441

442+
private void ApplySidebarWidthState()
443+
{
444+
if (UserSettingsService.AppearanceSettingsService.SidebarWidth > 340)
445+
VisualStateManager.GoToState(this, "LargeSidebarWidthState", true);
446+
else if (UserSettingsService.AppearanceSettingsService.SidebarWidth > 280)
447+
VisualStateManager.GoToState(this, "MediumSidebarWidthState", true);
448+
else
449+
VisualStateManager.GoToState(this, "SmallSidebarWidthState", true);
450+
}
451+
437452
private void LoadPaneChanged()
438453
{
439454
try

0 commit comments

Comments
 (0)