Skip to content

Commit a2a3ee1

Browse files
lampenlampenyaira2
authored andcommitted
Feat: Optional acrylic sidebar (#321)
* Feat: Optional acrylic sidebar * Settings UI * Acrylic Sidebar * Feat: Optional Acrylic Sidebar
1 parent c410f55 commit a2a3ee1

File tree

4 files changed

+32
-1
lines changed

4 files changed

+32
-1
lines changed

Files/ProHome.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@
297297
</Windows10version1903:Grid>
298298
</StackPanel>
299299

300-
<SplitView DisplayMode="Inline" OpenPaneLength="225" IsPaneOpen="True" HorizontalAlignment="Stretch" Grid.RowSpan="1" Grid.Row="1" VerticalAlignment="Stretch" PaneBackground="{ThemeResource ApplicationPageBackgroundThemeBrush}">
300+
<SplitView x:Name="splitView" DisplayMode="Inline" OpenPaneLength="225" IsPaneOpen="True" HorizontalAlignment="Stretch" Grid.RowSpan="1" Grid.Row="1" VerticalAlignment="Stretch" PaneBackground="{ThemeResource ApplicationPageBackgroundThemeBrush}">
301301
<SplitView.Pane>
302302
<ScrollViewer Margin="0,0,0,0" VerticalScrollBarVisibility="Auto">
303303
<Grid>

Files/ProHome.xaml.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@
1414
using Windows.UI.Xaml;
1515
using Windows.UI.Xaml.Controls;
1616
using Windows.UI.Xaml.Input;
17+
using Windows.UI.Xaml.Media;
1718
using Windows.UI.Xaml.Media.Animation;
1819
using Windows.UI.Xaml.Navigation;
20+
using Files.Enums;
21+
using System.Drawing;
1922

2023
namespace Files
2124
{
@@ -59,6 +62,15 @@ public ProHome()
5962
{
6063
themeShadow.Receivers.Add(ShadowReceiver);
6164
}
65+
66+
// Acrylic sidebar
67+
var localSettings = ApplicationData.Current.LocalSettings;
68+
if (localSettings.Values["acrylicSidebar"] != null && localSettings.Values["acrylicSidebar"].Equals(true))
69+
{
70+
splitView.PaneBackground = (Brush)Application.Current.Resources["BackgroundAcrylicBrush"];
71+
Application.Current.Resources["NavigationViewExpandedPaneBackground"] = Application.Current.Resources["BackgroundAcrylicBrush"];
72+
}
73+
6274
}
6375

6476
string NavParams = null;

Files/SettingsPages/Personalization.xaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
<TextBlock x:Name="TimeFormatReminder" Opacity="0.0" Foreground="Green" VerticalAlignment="Center" Text="Refresh list to apply time format." Margin="15,0,0,0"/>
2626
</StackPanel>
2727
</StackPanel>
28+
<StackPanel Orientation="Horizontal">
29+
<TextBlock Margin="0,0,0,0" HorizontalAlignment="Left" Text="Acrylic sidebar" TextWrapping="Wrap" VerticalAlignment="Center" FontSize="18"/>
30+
<ToggleSwitch CornerRadius="2" x:Name="AcrylicSidebarSwitch" HorizontalAlignment="Left" Margin="10,0,0,0" VerticalAlignment="Center" Width="300" />
31+
</StackPanel>
2832
</StackPanel>
2933
</ScrollViewer>
3034

Files/SettingsPages/Personalization.xaml.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,21 @@ public Personalization()
5454
};
5555
};
5656
}
57+
58+
// Acrylic Sidebar
59+
if (localSettings.Values["acrylicSidebar"] != null)
60+
{
61+
var isAcrylicSidebarEnabled = bool.Parse(localSettings.Values["acrylicSidebar"].ToString());
62+
AcrylicSidebarSwitch.IsOn = isAcrylicSidebarEnabled;
63+
}
64+
65+
AcrylicSidebarSwitch.Loaded += (sender, args) =>
66+
{
67+
AcrylicSidebarSwitch.Toggled += (o, eventArgs) =>
68+
{
69+
localSettings.Values["acrylicSidebar"] = ((ToggleSwitch)o).IsOn;
70+
};
71+
};
5772
}
5873

5974
private static ThemeValueClass tv = new ThemeValueClass();

0 commit comments

Comments
 (0)