Skip to content

Commit e326b79

Browse files
committed
Add Dark Theme Support
1 parent e7b5a5f commit e326b79

12 files changed

+507
-125
lines changed

App.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
55
xmlns:local="using:Files"
6-
RequestedTheme="Light">
6+
xmlns:pages="using:Files.SettingsPages">
77

88

99
</Application>

App.xaml.cs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
using System;
2+
using System.Diagnostics;
23
using Windows.ApplicationModel;
34
using Windows.ApplicationModel.Activation;
45
using Windows.Storage;
6+
using Windows.UI;
57
using Windows.UI.Xaml;
68
using Windows.UI.Xaml.Controls;
79
using Windows.UI.Xaml.Navigation;
@@ -22,6 +24,40 @@ public App()
2224
{
2325
this.InitializeComponent();
2426
this.Suspending += OnSuspending;
27+
Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
28+
29+
if (localSettings.Values["theme"] != null)
30+
{
31+
if (localSettings.Values["theme"].ToString() == "Light")
32+
{
33+
SettingsPages.Personalization.TV.ThemeValue = ApplicationTheme.Light;
34+
Debug.WriteLine("Theme Requested as Light");
35+
}
36+
else if (localSettings.Values["theme"].ToString() == "Dark")
37+
{
38+
SettingsPages.Personalization.TV.ThemeValue = ApplicationTheme.Dark;
39+
Debug.WriteLine("Theme Requested as Dark");
40+
}
41+
else
42+
{
43+
var uiSettings = new Windows.UI.ViewManagement.UISettings();
44+
var color = uiSettings.GetColorValue(Windows.UI.ViewManagement.UIColorType.Background);
45+
if (color == Colors.White)
46+
{
47+
SettingsPages.Personalization.TV.ThemeValue = ApplicationTheme.Light;
48+
Debug.WriteLine("Theme Requested as Default (Light)");
49+
50+
}
51+
else
52+
{
53+
SettingsPages.Personalization.TV.ThemeValue = ApplicationTheme.Dark;
54+
Debug.WriteLine("Theme Requested as Default (Dark)");
55+
}
56+
}
57+
}
58+
59+
this.RequestedTheme = SettingsPages.Personalization.TV.ThemeValue;
60+
Debug.WriteLine("!!Requested Theme!!" + RequestedTheme.ToString());
2561
}
2662

2763
/// <summary>
@@ -65,6 +101,7 @@ protected override void OnLaunched(LaunchActivatedEventArgs e)
65101
}
66102
// Ensure the current window is active
67103
Window.Current.Activate();
104+
68105
}
69106
}
70107

GenericFileBrowser.xaml

Lines changed: 43 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
1111
This file contains the markup code for the regular item layout -->
1212

13-
13+
1414
<Page
1515
x:Class="Files.GenericFileBrowser"
1616
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
@@ -131,33 +131,39 @@
131131
</VisualStateManager.VisualStateGroups>
132132

133133

134-
<Grid Tag="{x:Bind Tag, Mode=OneWay}" Background="White" Margin="0,0,0,0">
135-
<TextBlock Name="EmptyText" Visibility="{x:Bind local2:ItemViewModel.TextState.isVisible, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left" Text="This folder is empty." TextWrapping="Wrap" VerticalAlignment="Top" Margin="475,275,0,0" Canvas.ZIndex="5"/>
136-
<Grid DataContext="{Binding BackObject}" HorizontalAlignment="Stretch" Height="200" VerticalAlignment="Top">
137-
<Button BorderThickness="1.5" Style="{ThemeResource FluentHistoryButton}" x:FieldModifier="public" IsEnabled="{x:Bind local2:ItemViewModel.BS.isEnabled, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" x:Name="Back" Foreground="Black" Content="&#xE76B;" FontFamily="Segoe MDL2 Assets" Background="#33FFFFFF" FontSize="20" Margin="40,52,0,0" VerticalAlignment="Top" Height="50" Width="50">
138-
139-
</Button>
140-
<Grid DataContext="{Binding ForwardObject}">
141-
<Button BorderThickness="1.5" Style="{ThemeResource ButtonRevealStyle}" IsEnabled="{x:Bind local2:ItemViewModel.FS.isEnabled, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" x:Name="Forward" Foreground="Black" Content="&#xE76C;" FontFamily="Segoe MDL2 Assets" Background="#33FFFFFF" Margin="95,52,0,0" FontSize="20" VerticalAlignment="Top" Height="50" Width="50" HorizontalAlignment="Left"/>
142-
</Grid>
143-
<Button x:Name="Refresh" BorderThickness="1.5" Style="{ThemeResource ButtonRevealStyle}" Foreground="Black" Content="&#xE72C;" FontFamily="Segoe MDL2 Assets" Background="#33FFFFFF" FontSize="20" Margin="150,52,0,0" VerticalAlignment="Top" Width="50" Height="50" />
144-
<Button x:Name="Menu" BorderThickness="1.5" Style="{ThemeResource ButtonRevealStyle}" Foreground="Black" Content="&#xE712;" FontFamily="Segoe MDL2 Assets" Background="#33FFFFFF" FontSize="20" Margin="150,52,40,0" VerticalAlignment="Top" HorizontalAlignment="Right" Width="50" Height="50">
145-
<Button.Flyout>
146-
<MenuFlyout>
147-
<MenuFlyoutItem Name="NewItem" Text="New..."/>
148-
<MenuFlyoutItem Name="PasteItem" Text="Paste"/>
149-
<MenuFlyoutItem Name="CopyPath" Text="Copy Path"/>
150-
<MenuFlyoutItem Name="ViewModeChange" Text="Change View Mode..."/>
151-
</MenuFlyout>
152-
</Button.Flyout>
153-
</Button>
154-
<ScrollViewer HorizontalScrollMode="Auto" HorizontalScrollBarVisibility="Auto" Margin="50,126,50,25" HorizontalAlignment="Stretch" VerticalAlignment="Top" >
155-
<TextBlock x:Name="VisiblePath" Text="{x:Bind local:GenericFileBrowser.P.path ,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="0,0,0,0" FontFamily="Segoe UI Black" FontWeight="Bold" FontSize="32" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto" VerticalAlignment="Top" HorizontalAlignment="Stretch"></TextBlock>
156-
</ScrollViewer>
134+
<Grid Tag="{x:Bind Tag, Mode=OneWay}" Background="{StaticResource ApplicationPageBackgroundThemeBrush}" Padding="50,0,50,0">
135+
<Grid.RowDefinitions>
136+
<RowDefinition Height="20*"/>
137+
<RowDefinition Height="80*"/>
138+
</Grid.RowDefinitions>
139+
<TextBlock Name="EmptyText" Visibility="{x:Bind local2:ItemViewModel.TextState.isVisible, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left" Text="This folder is empty." TextWrapping="Wrap" VerticalAlignment="Top" Margin="475,100,0,0" Canvas.ZIndex="5" Grid.Row="1"/>
140+
<Grid DataContext="{Binding BackObject}" VerticalAlignment="Stretch" Margin="0,0,0,0">
141+
<StackPanel Orientation="Horizontal" Margin="0,0,0,25">
142+
<AppBarButton Style="{ThemeResource AppBarButtonRevealStyle}" x:FieldModifier="public" IsEnabled="{x:Bind local2:ItemViewModel.BS.isEnabled, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" x:Name="Back" Content="&#xE76B;" FontFamily="Segoe MDL2 Assets" FontSize="20" VerticalAlignment="Center" Height="50" Width="50">
157143

144+
</AppBarButton>
145+
<Grid DataContext="{Binding ForwardObject}" VerticalAlignment="Center">
146+
<AppBarButton Style="{ThemeResource AppBarButtonRevealStyle}" IsEnabled="{x:Bind local2:ItemViewModel.FS.isEnabled, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" x:Name="Forward" Content="&#xE76C;" FontFamily="Segoe MDL2 Assets" FontSize="20" VerticalAlignment="Top" Height="50" Width="50" HorizontalAlignment="Left"/>
147+
</Grid>
148+
<AppBarButton x:Name="Refresh" Style="{ThemeResource AppBarButtonRevealStyle}" Content="&#xE72C;" FontFamily="Segoe MDL2 Assets" FontSize="20" VerticalAlignment="Center" Width="50" Height="50" />
149+
</StackPanel>
150+
151+
<AppBarButton x:Name="Menu" Style="{ThemeResource AppBarButtonRevealStyle}" Content="&#xE712;" FontFamily="Segoe MDL2 Assets" FontSize="20" VerticalAlignment="Center" HorizontalAlignment="Right" Width="50" Height="50">
152+
<Button.Flyout>
153+
<MenuFlyout>
154+
<MenuFlyoutItem Name="NewItem" Text="New..."/>
155+
<MenuFlyoutItem Name="PasteItem" Text="Paste"/>
156+
<MenuFlyoutItem Name="CopyPath" Text="Copy Path"/>
157+
<MenuFlyoutItem Name="ViewModeChange" Text="Change View Mode..."/>
158+
</MenuFlyout>
159+
</Button.Flyout>
160+
</AppBarButton>
161+
<ScrollViewer HorizontalScrollMode="Auto" HorizontalScrollBarVisibility="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" >
162+
<TextBlock x:Name="VisiblePath" Text="{x:Bind local:GenericFileBrowser.P.path,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="0,0,0,0" FontFamily="Segoe UI Black" FontWeight="Bold" FontSize="32" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto" VerticalAlignment="Top" HorizontalAlignment="Stretch"></TextBlock>
163+
</ScrollViewer>
158164
</Grid>
159165

160-
<Grid Padding="50,200,50,0">
166+
<Grid Padding="0,25,0,0" HorizontalAlignment="Stretch" Margin="0,0,0,0" VerticalAlignment="Stretch" Grid.Row="1">
161167

162168
<controls:DataGrid FocusVisualPrimaryThickness="0" SelectionMode="Extended" IsDoubleTapEnabled="True" x:FieldModifier="public" x:Name="AllView" Drop="AllView_DropAsync" AutoGenerateColumns="False" CanDrag="False" AllowDrop="True" DragOver="AllView_DragOver" IsRightTapEnabled="True" CanUserReorderColumns="False" IsReadOnly="True" ItemsSource="{x:Bind local2:ItemViewModel.FilesAndFolders}" Margin="0,0,0,0" Padding="0, 0, 0, 0" HorizontalAlignment="Left">
163169

@@ -188,7 +194,7 @@
188194
<FontIcon Glyph="&#xE72D;"/>
189195
</MenuFlyoutItem.Icon>
190196
</MenuFlyoutItem>
191-
197+
192198
<MenuFlyoutSeparator/>
193199
<MenuFlyoutItem Text="Delete" Name="DeleteItem" >
194200
<MenuFlyoutItem.Icon>
@@ -230,8 +236,8 @@
230236
</Setter>
231237
</Style>
232238
</controls:DataGrid.RowStyle>-->
233-
234-
<controls:DataGrid.Columns>
239+
240+
<controls:DataGrid.Columns>
235241
<controls:DataGridTemplateColumn>
236242
<controls:DataGridTemplateColumn.CellTemplate>
237243
<DataTemplate>
@@ -253,17 +259,17 @@
253259

254260

255261
</Grid>
256-
<Grid Visibility="Collapsed" Background="{StaticResource Accent}" VerticalAlignment="Bottom" Height="30">
262+
<Grid Visibility="Collapsed" Background="{StaticResource Accent}" VerticalAlignment="Top" Height="30" HorizontalAlignment="Stretch" Margin="0,872,0,0" Grid.Row="1">
257263

258264
</Grid>
259-
<controls:DropShadowPanel x:Name="ProgressBox" Visibility="{x:Bind local2:ItemViewModel.PVIS.isVisible, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Center" VerticalAlignment="Center" Width="500" Height="225">
260-
<Grid>
261-
<Rectangle Fill="White" Stroke="White" Width="500" Height="225" HorizontalAlignment="Center" VerticalAlignment="Center"/>
262-
<TextBlock Text="{x:Bind local2:ItemViewModel.PUIH.Header, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="25,0,0,150" FontSize="22"/>
263-
<Button Content="Hide" HorizontalAlignment="Right" Margin="0,0,25,25" VerticalAlignment="Bottom" Width="175" Click="Button_Click"/>
264-
<TextBlock Text="{x:Bind local2:ItemViewModel.PUIP.Path, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="25,0,0,50" FontSize="14"/>
265-
<ProgressBar Name="pbar" Value="{x:Bind local2:ItemViewModel.PROGRESSPER.prog, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" Height="8" HorizontalAlignment="Center" Width="450" Margin="0,50,0,0"/>
266-
</Grid>
265+
<controls:DropShadowPanel x:Name="ProgressBox" Visibility="{x:Bind local2:ItemViewModel.PVIS.isVisible, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Center" VerticalAlignment="Top" Width="500" Height="225" Margin="0,150,0,0" Grid.Row="1">
266+
<Grid>
267+
<Rectangle Fill="{ThemeResource ApplicationPageBackgroundThemeBrush}" Stroke="White" Width="500" Height="225" HorizontalAlignment="Center" VerticalAlignment="Center"/>
268+
<TextBlock Text="{x:Bind local2:ItemViewModel.PUIH.Header, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="25,0,0,150" FontSize="22"/>
269+
<Button Content="Hide" HorizontalAlignment="Right" Margin="0,0,25,25" VerticalAlignment="Bottom" Width="175" Click="Button_Click"/>
270+
<TextBlock Text="{x:Bind local2:ItemViewModel.PUIP.Path, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="25,0,0,50" FontSize="14"/>
271+
<ProgressBar Name="pbar" Value="{x:Bind local2:ItemViewModel.PROGRESSPER.prog, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" Height="8" HorizontalAlignment="Center" Width="450" Margin="0,50,0,0"/>
272+
</Grid>
267273
</controls:DropShadowPanel>
268274
</Grid>
269275

MainPage.xaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
<Grid Tag="{x:Bind Tag, Mode=OneWay}" Background="Transparent" Name="DragArea" HorizontalAlignment="Stretch" Height="34" VerticalAlignment="Top" Margin="55,0,200,0" Canvas.ZIndex="5"/>
3333

34-
<NavigationView SelectedItem="{x:Bind local:MainPage.Select.itemSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" x:FieldModifier="public" AlwaysShowHeader="False" IsPaneOpen="True" Loaded="navView_Loaded" IsBackButtonVisible="Collapsed" IsSettingsVisible="True" x:Name="navView" SelectionChanged="navView_ItemSelected" VerticalAlignment="Stretch" >
34+
<NavigationView RequestedTheme="Default" SelectedItem="{x:Bind local:MainPage.Select.itemSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" x:FieldModifier="public" AlwaysShowHeader="False" IsPaneOpen="True" Loaded="navView_Loaded" IsBackButtonVisible="Collapsed" IsSettingsVisible="True" x:Name="navView" SelectionChanged="navView_ItemSelected" VerticalAlignment="Stretch" >
3535

3636

3737
<NavigationView.MenuItems>
@@ -95,11 +95,11 @@
9595

9696
<NavigationView.AutoSuggestBox>
9797

98-
<AutoSuggestBox QuerySubmitted="auto_suggest_QuerySubmitted" x:Name="auto_suggest" PlaceholderText="Search" QueryIcon="Find"/>
98+
<AutoSuggestBox BorderThickness="0.5" QuerySubmitted="auto_suggest_QuerySubmitted" x:Name="auto_suggest" PlaceholderText="Search" QueryIcon="Find"/>
9999
</NavigationView.AutoSuggestBox>
100100

101101

102-
<Frame Name="ContentFrame" Background="White">
102+
<Frame Name="ContentFrame" Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
103103
<Frame.ContentTransitions>
104104
<TransitionCollection>
105105
<NavigationThemeTransition/>

ProgressBoxSystem.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
//
1313

1414

15-
16-
1715
using System.ComponentModel;
1816
using Windows.UI.Xaml;
1917

SettingsPages/About.xaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
1-
<Page
1+
<!--- About.xaml
2+
3+
Copyright 2018 Luke Blevins
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
This file contains the markup code for the About settings page -->
12+
13+
<Page
214
x:Class="Files.SettingsPages.About"
315
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
416
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

SettingsPages/About.xaml.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1-
using Interact;
1+
// ---- About.xaml.cs ----
2+
//
3+
// Copyright 2018 Luke Blevins
4+
//
5+
// Licensed under the Apache License, Version 2.0 (the "License");
6+
// you may not use this file except in compliance with the License.
7+
// You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// ---- This file contains various behind-the-scenes code for the About settings page ----
12+
//
13+
14+
15+
using Interact;
216
using System;
317
using System.Collections.Generic;
418
using System.IO;

SettingsPages/Personalization.xaml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,24 @@
2121
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
2222

2323

24-
<Grid>
25-
<TextBlock x:Name="Header" Text="Personalization" Margin="50,100,0,0" FontFamily="Segoe UI Black" FontWeight="Bold" FontSize="48" HorizontalAlignment="Left" VerticalAlignment="Top" />
26-
<TextBlock HorizontalAlignment="Left" Margin="50,475,0,0" Text="Choose your color scheme" TextWrapping="Wrap" VerticalAlignment="Top" FontSize="18"/>
27-
<RadioButton Content="Light" HorizontalAlignment="Left" Margin="50,511,0,0" VerticalAlignment="Top"/>
28-
<RadioButton Content="Dark" HorizontalAlignment="Left" Margin="50,548,0,0" VerticalAlignment="Top"/>
29-
<RadioButton Content="High Contrast" HorizontalAlignment="Left" Margin="175,511,0,0" VerticalAlignment="Top"/>
30-
<RadioButton Content="Use System Scheme" HorizontalAlignment="Left" Margin="175,548,0,0" VerticalAlignment="Top"/>
31-
<Grid HorizontalAlignment="Left" VerticalAlignment="Top" Margin="50,175,0,0">
32-
<Rectangle Name="VisualRect" Fill="{ThemeResource SystemControlAcrylicElementBrush}" Width="384" Height="216" HorizontalAlignment="Center" VerticalAlignment="Center" Canvas.ZIndex="2" />
33-
<Image HorizontalAlignment="Stretch" Margin="0,0,0,0" VerticalAlignment="Stretch" Source="ms-appx:///Assets/abstract_HeroImage.jpg" Stretch="UniformToFill" Width="480" Height="270"/>
24+
<Grid Padding="50,100,50,0">
25+
<StackPanel>
26+
<TextBlock x:Name="Header" Text="Personalization" Margin="0,0,0,25" FontFamily="Segoe UI Black" FontWeight="Bold" FontSize="48" HorizontalAlignment="Left" VerticalAlignment="Top" />
27+
<Grid Margin="0,0,0,25" HorizontalAlignment="Left" VerticalAlignment="Top">
28+
<Rectangle Name="VisualRect" Fill="{ThemeResource SystemControlAcrylicElementBrush}" Width="384" Height="216" HorizontalAlignment="Center" VerticalAlignment="Center" Canvas.ZIndex="2" />
29+
<Image HorizontalAlignment="Stretch" Margin="0,0,0,0" VerticalAlignment="Stretch" Source="ms-appx:///Assets/abstract_HeroImage.jpg" Stretch="UniformToFill" Width="480" Height="270"/>
3430
</Grid>
31+
<TextBlock Margin="0,0,0,15" HorizontalAlignment="Left" Text="Choose your color scheme" TextWrapping="Wrap" VerticalAlignment="Top" FontSize="18"/>
32+
<ComboBox SelectionChanged="ThemeChooser_SelectionChanged" Name="ThemeChooser" HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Center" Width="225">
33+
<ComboBox.Items>
34+
<ComboBoxItem Content="Use System Scheme"/>
35+
<ComboBoxItem Content="Light"/>
36+
<ComboBoxItem Content="Dark"/>
37+
</ComboBox.Items>
38+
</ComboBox>
39+
40+
41+
</StackPanel>
3542
</Grid>
3643

3744
</Page>

0 commit comments

Comments
 (0)