diff --git a/Directory.Packages.props b/Directory.Packages.props
index 7912ed0cdfff..7217b3c0fe70 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -7,6 +7,7 @@
+
diff --git a/NOTICE.md b/NOTICE.md
index 1e6c6681b2ce..b9278590993e 100644
--- a/NOTICE.md
+++ b/NOTICE.md
@@ -284,6 +284,7 @@ SOFTWARE.
- CommunityToolkit.Labs.WinUI.SettingsControls 0.0.18
- CommunityToolkit.Mvvm 8.2.0
- CommunityToolkit.WinUI.UI 7.1.2
+- CommunityToolkit.WinUI.UI.Animations 7.1.2
- CommunityToolkit.WinUI.UI.Controls 7.1.2
- ControlzEx 5.0.1
- HelixToolkit 2.20.2
diff --git a/src/settings-ui/Settings.UI/App.xaml b/src/settings-ui/Settings.UI/App.xaml
index b4e581d64d59..e32dfc58d1ba 100644
--- a/src/settings-ui/Settings.UI/App.xaml
+++ b/src/settings-ui/Settings.UI/App.xaml
@@ -3,9 +3,9 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
- xmlns:local="using:Microsoft.PowerToys.Settings.UI"
xmlns:converters="using:CommunityToolkit.WinUI.UI.Converters"
- xmlns:labs="using:CommunityToolkit.Labs.WinUI">
+ xmlns:labs="using:CommunityToolkit.Labs.WinUI"
+ xmlns:local="using:Microsoft.PowerToys.Settings.UI">
@@ -54,14 +54,17 @@
-
+
+
+
+
-
-
+
+
+
+
diff --git a/src/settings-ui/Settings.UI/App.xaml.cs b/src/settings-ui/Settings.UI/App.xaml.cs
index ec57d0cf1e37..98103dc8339d 100644
--- a/src/settings-ui/Settings.UI/App.xaml.cs
+++ b/src/settings-ui/Settings.UI/App.xaml.cs
@@ -85,6 +85,7 @@ public static void OpenSettingsWindow(Type type = null, bool ensurePageIsSelecte
}
settingsWindow.Activate();
+
if (type != null)
{
settingsWindow.NavigateToSection(type);
@@ -104,7 +105,6 @@ public static void OpenSettingsWindow(Type type = null, bool ensurePageIsSelecte
protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
{
var cmdArgs = Environment.GetCommandLineArgs();
-
var isDark = IsDarkTheme();
if (cmdArgs != null && cmdArgs.Length >= RequiredArgumentsQty)
@@ -164,6 +164,7 @@ protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs ar
{
settingsWindow = new MainWindow(isDark);
settingsWindow.Activate();
+ settingsWindow.ExtendsContentIntoTitleBar = true;
settingsWindow.NavigateToSection(StartupPage);
// https://github.com/microsoft/microsoft-ui-xaml/issues/7595 - Activate doesn't bring window to the foreground
@@ -182,6 +183,7 @@ protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs ar
PowerToysTelemetry.Log.WriteEvent(new OobeStartedEvent());
OobeWindow oobeWindow = new OobeWindow(OOBE.Enums.PowerToysModules.Overview, isDark);
oobeWindow.Activate();
+ oobeWindow.ExtendsContentIntoTitleBar = true;
SetOobeWindow(oobeWindow);
}
else if (ShowScoobe)
@@ -189,6 +191,7 @@ protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs ar
PowerToysTelemetry.Log.WriteEvent(new ScoobeStartedEvent());
OobeWindow scoobeWindow = new OobeWindow(OOBE.Enums.PowerToysModules.WhatsNew, isDark);
scoobeWindow.Activate();
+ scoobeWindow.ExtendsContentIntoTitleBar = true;
SetOobeWindow(scoobeWindow);
}
else if (ShowFlyout)
@@ -208,7 +211,9 @@ protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs ar
// For debugging purposes
// Window is also needed to show MessageDialog
settingsWindow = new MainWindow(isDark);
+ settingsWindow.ExtendsContentIntoTitleBar = true;
settingsWindow.Activate();
+ settingsWindow.NavigateToSection(StartupPage);
#if !DEBUG
ShowMessageDialogAndExit("The application cannot be run as a standalone process. Please start the application through the runner.", "Forbidden");
@@ -248,36 +253,43 @@ public static TwoWayPipeMessageIPCManaged GetTwoWayIPCManager()
return ipcmanager;
}
- public static string SelectedTheme()
+ public static ElementTheme SelectedTheme()
{
- return SettingsRepository.GetInstance(settingsUtils).SettingsConfig.Theme.ToUpper(CultureInfo.InvariantCulture);
+ switch (SettingsRepository.GetInstance(settingsUtils).SettingsConfig.Theme.ToUpper(CultureInfo.InvariantCulture))
+ {
+ case "DARK": return ElementTheme.Dark;
+ case "LIGHT": return ElementTheme.Light;
+ default: return ElementTheme.Default;
+ }
}
public static bool IsDarkTheme()
{
var selectedTheme = SelectedTheme();
- return selectedTheme == "DARK" || (selectedTheme == "SYSTEM" && ThemeHelpers.GetAppTheme() == AppTheme.Dark);
+ return selectedTheme == ElementTheme.Dark || (selectedTheme == ElementTheme.Default && ThemeHelpers.GetAppTheme() == AppTheme.Dark);
}
public static void HandleThemeChange()
{
try
{
- var isDark = IsDarkTheme();
+ bool isDark = IsDarkTheme();
+
if (settingsWindow != null)
{
var hWnd = WinRT.Interop.WindowNative.GetWindowHandle(settingsWindow);
ThemeHelpers.SetImmersiveDarkMode(hWnd, isDark);
+ SetContentTheme(isDark, settingsWindow);
}
if (oobeWindow != null)
{
var hWnd = WinRT.Interop.WindowNative.GetWindowHandle(oobeWindow);
ThemeHelpers.SetImmersiveDarkMode(hWnd, isDark);
+ SetContentTheme(isDark, oobeWindow);
}
- var selectedTheme = SelectedTheme();
- if (selectedTheme == "SYSTEM")
+ if (SelectedTheme() == ElementTheme.Default)
{
themeListener = new ThemeListener();
themeListener.ThemeChanged += (_) => HandleThemeChange();
@@ -298,6 +310,22 @@ public static void HandleThemeChange()
}
}
+ public static void SetContentTheme(bool isDark, WindowEx window)
+ {
+ var rootGrid = (FrameworkElement)window.Content;
+ if (rootGrid != null)
+ {
+ if (isDark)
+ {
+ rootGrid.RequestedTheme = ElementTheme.Dark;
+ }
+ else
+ {
+ rootGrid.RequestedTheme = ElementTheme.Light;
+ }
+ }
+ }
+
private static ISettingsUtils settingsUtils = new SettingsUtils();
private static MainWindow settingsWindow;
diff --git a/src/settings-ui/Settings.UI/Controls/SettingsPageControl/SettingsPageControl.xaml b/src/settings-ui/Settings.UI/Controls/SettingsPageControl/SettingsPageControl.xaml
index 1252811ccf4a..54f871a80aed 100644
--- a/src/settings-ui/Settings.UI/Controls/SettingsPageControl/SettingsPageControl.xaml
+++ b/src/settings-ui/Settings.UI/Controls/SettingsPageControl/SettingsPageControl.xaml
@@ -46,7 +46,6 @@
-
-
-
-
+
+
+
+
diff --git a/src/settings-ui/Settings.UI/MainWindow.xaml.cs b/src/settings-ui/Settings.UI/MainWindow.xaml.cs
index 896f95ed847e..e26ec2683de7 100644
--- a/src/settings-ui/Settings.UI/MainWindow.xaml.cs
+++ b/src/settings-ui/Settings.UI/MainWindow.xaml.cs
@@ -220,6 +220,8 @@ public MainWindow(bool isDark, bool createHidden = false)
this.InitializeComponent();
+ SetTheme(isDark);
+
// receive IPC Message
App.IPCMessageReceivedCallback = (string msg) =>
{
@@ -279,5 +281,10 @@ internal void EnsurePageIsSelected()
{
ShellPage.EnsurePageIsSelected();
}
+
+ private void SetTheme(bool isDark)
+ {
+ shellPage.RequestedTheme = isDark ? ElementTheme.Dark : ElementTheme.Light;
+ }
}
}
diff --git a/src/settings-ui/Settings.UI/OOBE/Views/OobeShellPage.xaml b/src/settings-ui/Settings.UI/OOBE/Views/OobeShellPage.xaml
index 26dae05314a3..009d30745929 100644
--- a/src/settings-ui/Settings.UI/OOBE/Views/OobeShellPage.xaml
+++ b/src/settings-ui/Settings.UI/OOBE/Views/OobeShellPage.xaml
@@ -2,22 +2,73 @@
x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeShellPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:animations="using:CommunityToolkit.WinUI.UI.Animations"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.Views"
- xmlns:localModels="using:Microsoft.PowerToys.Settings.UI.OOBE.ViewModel"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="using:CommunityToolkit.WinUI.UI"
HighContrastAdjustment="None"
+ Loaded="ShellPage_Loaded"
mc:Ignorable="d">
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/settings-ui/Settings.UI/OOBE/Views/OobeShellPage.xaml.cs b/src/settings-ui/Settings.UI/OOBE/Views/OobeShellPage.xaml.cs
index 58a5e099b666..3c2ab9549d00 100644
--- a/src/settings-ui/Settings.UI/OOBE/Views/OobeShellPage.xaml.cs
+++ b/src/settings-ui/Settings.UI/OOBE/Views/OobeShellPage.xaml.cs
@@ -59,10 +59,9 @@ public OobeShellPage()
InitializeComponent();
ExperimentationToggleSwitchEnabled = SettingsRepository.GetInstance(settingsUtils).SettingsConfig.EnableExperimentation;
-
+ SetTitleBar();
DataContext = ViewModel;
OobeShellHandler = this;
- UpdateUITheme();
Modules = new ObservableCollection();
Modules.Insert((int)PowerToysModules.Overview, new OobePowerToysModule()
@@ -190,7 +189,7 @@ public OobeShellPage()
public void OnClosing()
{
- Microsoft.UI.Xaml.Controls.NavigationViewItem selectedItem = this.NavigationView.SelectedItem as Microsoft.UI.Xaml.Controls.NavigationViewItem;
+ Microsoft.UI.Xaml.Controls.NavigationViewItem selectedItem = this.navigationView.SelectedItem as Microsoft.UI.Xaml.Controls.NavigationViewItem;
if (selectedItem != null)
{
Modules[(int)(PowerToysModules)Enum.Parse(typeof(PowerToysModules), (string)selectedItem.Tag, true)].LogClosingModuleEvent();
@@ -201,11 +200,11 @@ public void NavigateToModule(PowerToysModules selectedModule)
{
if (selectedModule == PowerToysModules.WhatsNew)
{
- NavigationView.SelectedItem = NavigationView.FooterMenuItems[0];
+ navigationView.SelectedItem = navigationView.FooterMenuItems[0];
}
else
{
- NavigationView.SelectedItem = NavigationView.MenuItems[(int)selectedModule];
+ navigationView.SelectedItem = navigationView.MenuItems[(int)selectedModule];
}
}
@@ -264,20 +263,42 @@ private void NavigationView_SelectionChanged(Microsoft.UI.Xaml.Controls.Navigati
}
}
- public void UpdateUITheme()
+ private void SetTitleBar()
{
- switch (SettingsRepository.GetInstance(new SettingsUtils()).SettingsConfig.Theme.ToUpperInvariant())
+ var u = App.GetOobeWindow();
+ if (u != null)
{
- case "LIGHT":
- this.RequestedTheme = ElementTheme.Light;
- break;
- case "DARK":
- this.RequestedTheme = ElementTheme.Dark;
- break;
- case "SYSTEM":
- this.RequestedTheme = ElementTheme.Default;
- break;
+ // A custom title bar is required for full window theme and Mica support.
+ // https://docs.microsoft.com/windows/apps/develop/title-bar?tabs=winui3#full-customization
+ u.ExtendsContentIntoTitleBar = true;
+ u.SetTitleBar(AppTitleBar);
}
}
+
+ private void ShellPage_Loaded(object sender, RoutedEventArgs e)
+ {
+ SetTitleBar();
+ }
+
+ private void NavigationView_DisplayModeChanged(NavigationView sender, NavigationViewDisplayModeChangedEventArgs args)
+ {
+ if (args.DisplayMode == NavigationViewDisplayMode.Compact || args.DisplayMode == NavigationViewDisplayMode.Minimal)
+ {
+ PaneToggleBtn.Visibility = Visibility.Visible;
+ AppTitleBar.Margin = new Thickness(48, 0, 0, 0);
+ AppTitleBarText.Margin = new Thickness(12, 0, 0, 0);
+ }
+ else
+ {
+ PaneToggleBtn.Visibility = Visibility.Collapsed;
+ AppTitleBar.Margin = new Thickness(16, 0, 0, 0);
+ AppTitleBarText.Margin = new Thickness(16, 0, 0, 0);
+ }
+ }
+
+ private void PaneToggleBtn_Click(object sender, RoutedEventArgs e)
+ {
+ navigationView.IsPaneOpen = !navigationView.IsPaneOpen;
+ }
}
}
diff --git a/src/settings-ui/Settings.UI/OobeWindow.xaml b/src/settings-ui/Settings.UI/OobeWindow.xaml
index 2a23faa58930..4a5f4233de07 100644
--- a/src/settings-ui/Settings.UI/OobeWindow.xaml
+++ b/src/settings-ui/Settings.UI/OobeWindow.xaml
@@ -1,17 +1,17 @@
-
-
-
-
+
+
+
+
diff --git a/src/settings-ui/Settings.UI/OobeWindow.xaml.cs b/src/settings-ui/Settings.UI/OobeWindow.xaml.cs
index 983f60e64154..4ea99c3f1e74 100644
--- a/src/settings-ui/Settings.UI/OobeWindow.xaml.cs
+++ b/src/settings-ui/Settings.UI/OobeWindow.xaml.cs
@@ -48,6 +48,8 @@ public OobeWindow(PowerToysModules initialModule, bool isDark)
ThemeHelpers.SetImmersiveDarkMode(_hWnd, isDark);
}
+ SetTheme(isDark);
+
OverlappedPresenter presenter = _appWindow.Presenter as OverlappedPresenter;
presenter.IsMinimizable = false;
presenter.IsMaximizable = false;
@@ -118,5 +120,10 @@ private void Window_Closed(object sender, WindowEventArgs args)
mainWindow.CloseHiddenWindow();
}
}
+
+ private void SetTheme(bool isDark)
+ {
+ shellPage.RequestedTheme = isDark ? ElementTheme.Dark : ElementTheme.Light;
+ }
}
}
diff --git a/src/settings-ui/Settings.UI/PowerToys.Settings.csproj b/src/settings-ui/Settings.UI/PowerToys.Settings.csproj
index aee7efc5422d..decb2e5e719c 100644
--- a/src/settings-ui/Settings.UI/PowerToys.Settings.csproj
+++ b/src/settings-ui/Settings.UI/PowerToys.Settings.csproj
@@ -82,6 +82,7 @@
+
diff --git a/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw b/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw
index a23aed4deb37..99bc18bfa833 100644
--- a/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw
+++ b/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw
@@ -2149,6 +2149,9 @@ From there, simply click on one of the supported files in the File Explorer and
Welcome to PowerToys
+
+
+ Welcome to PowerToys
PowerToys Settings
@@ -3522,6 +3525,9 @@ Activate by holding the key for the character you want to add an accent to, then
Maximum width (px)
px = pixels
+
+ PowerToys Settings
+
A lightning fast file preview feature for Windows.
diff --git a/src/settings-ui/Settings.UI/Views/GeneralPage.xaml.cs b/src/settings-ui/Settings.UI/Views/GeneralPage.xaml.cs
index 92c3fd7da121..5d9051221cca 100644
--- a/src/settings-ui/Settings.UI/Views/GeneralPage.xaml.cs
+++ b/src/settings-ui/Settings.UI/Views/GeneralPage.xaml.cs
@@ -8,6 +8,7 @@
using ManagedCommon;
using Microsoft.PowerToys.Settings.UI.Helpers;
using Microsoft.PowerToys.Settings.UI.Library;
+using Microsoft.PowerToys.Settings.UI.OOBE.Views;
using Microsoft.PowerToys.Settings.UI.ViewModels;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
@@ -94,12 +95,15 @@ public static int UpdateUIThemeMethod(string themeName)
switch (themeName?.ToUpperInvariant())
{
case "LIGHT":
+ // OobeShellPage.OobeShellHandler.RequestedTheme = ElementTheme.Light;
ShellPage.ShellHandler.RequestedTheme = ElementTheme.Light;
break;
case "DARK":
+ // OobeShellPage.OobeShellHandler.RequestedTheme = ElementTheme.Dark;
ShellPage.ShellHandler.RequestedTheme = ElementTheme.Dark;
break;
case "SYSTEM":
+ // OobeShellPage.OobeShellHandler.RequestedTheme = ElementTheme.Default;
ShellPage.ShellHandler.RequestedTheme = ElementTheme.Default;
break;
default:
diff --git a/src/settings-ui/Settings.UI/Views/ShellPage.xaml b/src/settings-ui/Settings.UI/Views/ShellPage.xaml
index df9ee29d8d80..ade6679c925c 100644
--- a/src/settings-ui/Settings.UI/Views/ShellPage.xaml
+++ b/src/settings-ui/Settings.UI/Views/ShellPage.xaml
@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.Views.ShellPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:animations="using:CommunityToolkit.WinUI.UI.Animations"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:helpers="using:Microsoft.PowerToys.Settings.UI.Helpers"
xmlns:i="using:Microsoft.Xaml.Interactivity"
@@ -10,11 +11,8 @@
xmlns:ui="using:CommunityToolkit.WinUI.UI"
xmlns:views="using:Microsoft.PowerToys.Settings.UI.Views"
HighContrastAdjustment="None"
+ Loaded="ShellPage_Loaded"
mc:Ignorable="d">
-
@@ -22,14 +20,61 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+