diff --git a/.pipelines/pipeline.user.windows.yml b/.pipelines/pipeline.user.windows.yml
index f1f8004b78..ebb108aa5e 100644
--- a/.pipelines/pipeline.user.windows.yml
+++ b/.pipelines/pipeline.user.windows.yml
@@ -80,6 +80,7 @@ build:
- 'modules\FancyZones\FancyZonesEditor.dll'
- 'modules\FancyZones\ManagedCommon.dll'
- 'modules\FancyZones\Telemetry.dll'
+ - 'modules\FancyZones\Microsoft.PowerToys.Common.UI.dll'
- 'modules\FileExplorerPreview\MarkdownPreviewHandler.dll'
- 'modules\FileExplorerPreview\MarkdownPreviewHandler.comhost.dll'
- 'modules\FileExplorerPreview\powerpreview.dll'
diff --git a/installer/PowerToysSetup/Product.wxs b/installer/PowerToysSetup/Product.wxs
index 483d1e6aae..a27f944dd8 100644
--- a/installer/PowerToysSetup/Product.wxs
+++ b/installer/PowerToysSetup/Product.wxs
@@ -379,6 +379,7 @@
+
diff --git a/src/common/Microsoft.PowerToys.Common.UI/Microsoft.PowerToys.Common.UI.csproj b/src/common/Microsoft.PowerToys.Common.UI/Microsoft.PowerToys.Common.UI.csproj
index 4cc402447d..c05d50726f 100644
--- a/src/common/Microsoft.PowerToys.Common.UI/Microsoft.PowerToys.Common.UI.csproj
+++ b/src/common/Microsoft.PowerToys.Common.UI/Microsoft.PowerToys.Common.UI.csproj
@@ -1,5 +1,6 @@
-
+
+
netcoreapp3.1
true
diff --git a/src/common/Microsoft.PowerToys.Common.UI/ThemeManager.cs b/src/common/Microsoft.PowerToys.Common.UI/ThemeManager.cs
index 51c42f13a8..2d3106a66a 100644
--- a/src/common/Microsoft.PowerToys.Common.UI/ThemeManager.cs
+++ b/src/common/Microsoft.PowerToys.Common.UI/ThemeManager.cs
@@ -133,22 +133,22 @@ namespace Microsoft.PowerToys.Common.UI
else if (theme == Theme.HighContrastOne)
{
_currentTheme = Theme.HighContrastOne;
- ControlzEx.Theming.ThemeManager.Current.ChangeTheme(_app, HighContrastOneTheme, true);
+ ControlzEx.Theming.ThemeManager.Current.ChangeTheme(_app, HighContrastOneTheme);
}
else if (theme == Theme.HighContrastTwo)
{
_currentTheme = Theme.HighContrastTwo;
- ControlzEx.Theming.ThemeManager.Current.ChangeTheme(_app, HighContrastTwoTheme, true);
+ ControlzEx.Theming.ThemeManager.Current.ChangeTheme(_app, HighContrastTwoTheme);
}
else if (theme == Theme.HighContrastWhite)
{
_currentTheme = Theme.HighContrastWhite;
- ControlzEx.Theming.ThemeManager.Current.ChangeTheme(_app, HighContrastWhiteTheme, true);
+ ControlzEx.Theming.ThemeManager.Current.ChangeTheme(_app, HighContrastWhiteTheme);
}
else if (theme == Theme.HighContrastBlack)
{
_currentTheme = Theme.HighContrastBlack;
- ControlzEx.Theming.ThemeManager.Current.ChangeTheme(_app, HighContrastBlackTheme, true);
+ ControlzEx.Theming.ThemeManager.Current.ChangeTheme(_app, HighContrastBlackTheme);
}
else if (theme == Theme.Light)
{
diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/App.xaml.cs b/src/modules/fancyzones/editor/FancyZonesEditor/App.xaml.cs
index ba939028d5..c259daa011 100644
--- a/src/modules/fancyzones/editor/FancyZonesEditor/App.xaml.cs
+++ b/src/modules/fancyzones/editor/FancyZonesEditor/App.xaml.cs
@@ -14,6 +14,7 @@ using System.Threading.Tasks;
using System.Windows;
using FancyZonesEditor.Utils;
using ManagedCommon;
+using Microsoft.PowerToys.Common.UI;
namespace FancyZonesEditor
{
diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/FancyZonesEditor.csproj b/src/modules/fancyzones/editor/FancyZonesEditor/FancyZonesEditor.csproj
index c173f1a29e..c3eabfda28 100644
--- a/src/modules/fancyzones/editor/FancyZonesEditor/FancyZonesEditor.csproj
+++ b/src/modules/fancyzones/editor/FancyZonesEditor/FancyZonesEditor.csproj
@@ -65,7 +65,6 @@
-
all
@@ -79,6 +78,7 @@
+
diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/Utils/CustomLibraryThemeProvider.cs b/src/modules/fancyzones/editor/FancyZonesEditor/Utils/CustomLibraryThemeProvider.cs
deleted file mode 100644
index 7b564894dc..0000000000
--- a/src/modules/fancyzones/editor/FancyZonesEditor/Utils/CustomLibraryThemeProvider.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (c) Microsoft Corporation
-// The Microsoft Corporation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Collections.Generic;
-using ControlzEx.Theming;
-
-namespace FancyZonesEditor.Utils
-{
- public class CustomLibraryThemeProvider : LibraryThemeProvider
- {
- public static readonly CustomLibraryThemeProvider DefaultInstance = new CustomLibraryThemeProvider();
-
- public CustomLibraryThemeProvider()
- : base(true)
- {
- }
-
- ///
- public override void FillColorSchemeValues(Dictionary values, RuntimeThemeColorValues colorValues)
- {
- }
- }
-}
diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/Utils/ThemeManager.cs b/src/modules/fancyzones/editor/FancyZonesEditor/Utils/ThemeManager.cs
deleted file mode 100644
index 2316d51712..0000000000
--- a/src/modules/fancyzones/editor/FancyZonesEditor/Utils/ThemeManager.cs
+++ /dev/null
@@ -1,200 +0,0 @@
-// Copyright (c) Microsoft Corporation
-// The Microsoft Corporation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-using System;
-using System.Linq;
-using System.Windows;
-using ControlzEx.Theming;
-using Microsoft.Win32;
-
-namespace FancyZonesEditor.Utils
-{
- public class ThemeManager : IDisposable
- {
- private readonly Application _app;
- private const string LightTheme = "Light.Accent1";
- private const string DarkTheme = "Dark.Accent1";
- private const string HighContrastOneTheme = "HighContrast.Accent2";
- private const string HighContrastTwoTheme = "HighContrast.Accent3";
- private const string HighContrastBlackTheme = "HighContrast.Accent4";
- private const string HighContrastWhiteTheme = "HighContrast.Accent5";
-
- private Theme currentTheme;
- private bool _disposed;
-
- public event ThemeChangedHandler ThemeChanged;
-
- public ThemeManager(Application app)
- {
- _app = app;
-
- Uri highContrastOneThemeUri = new Uri("pack://application:,,,/Themes/HighContrast1.xaml");
- Uri highContrastTwoThemeUri = new Uri("pack://application:,,,/Themes/HighContrast2.xaml");
- Uri highContrastBlackThemeUri = new Uri("pack://application:,,,/Themes/HighContrastWhite.xaml");
- Uri highContrastWhiteThemeUri = new Uri("pack://application:,,,/Themes/HighContrastBlack.xaml");
- Uri lightThemeUri = new Uri("pack://application:,,,/Themes/Light.xaml");
- Uri darkThemeUri = new Uri("pack://application:,,,/Themes/Dark.xaml");
-
- ControlzEx.Theming.ThemeManager.Current.AddLibraryTheme(
- new LibraryTheme(
- highContrastOneThemeUri,
- CustomLibraryThemeProvider.DefaultInstance));
- ControlzEx.Theming.ThemeManager.Current.AddLibraryTheme(
- new LibraryTheme(
- highContrastTwoThemeUri,
- CustomLibraryThemeProvider.DefaultInstance));
- ControlzEx.Theming.ThemeManager.Current.AddLibraryTheme(
- new LibraryTheme(
- highContrastBlackThemeUri,
- CustomLibraryThemeProvider.DefaultInstance));
- ControlzEx.Theming.ThemeManager.Current.AddLibraryTheme(
- new LibraryTheme(
- highContrastWhiteThemeUri,
- CustomLibraryThemeProvider.DefaultInstance));
- ControlzEx.Theming.ThemeManager.Current.AddLibraryTheme(
- new LibraryTheme(
- lightThemeUri,
- CustomLibraryThemeProvider.DefaultInstance));
- ControlzEx.Theming.ThemeManager.Current.AddLibraryTheme(
- new LibraryTheme(
- darkThemeUri,
- CustomLibraryThemeProvider.DefaultInstance));
-
- ResetTheme();
- ControlzEx.Theming.ThemeManager.Current.ThemeSyncMode = ThemeSyncMode.SyncWithAppMode;
- ControlzEx.Theming.ThemeManager.Current.ThemeChanged += Current_ThemeChanged;
- SystemParameters.StaticPropertyChanged += SystemParameters_StaticPropertyChanged;
- }
-
- private void SystemParameters_StaticPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
- {
- if (e.PropertyName == nameof(SystemParameters.HighContrast))
- {
- ResetTheme();
- }
- }
-
- public Theme GetCurrentTheme()
- {
- return currentTheme;
- }
-
- private static Theme GetHighContrastBaseType()
- {
- string registryKey = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes";
- string theme = (string)Registry.GetValue(registryKey, "CurrentTheme", string.Empty);
- theme = theme.Split('\\').Last().Split('.').First().ToString();
-
- switch (theme)
- {
- case "hc1":
- return Theme.HighContrastOne;
- case "hc2":
- return Theme.HighContrastTwo;
- case "hcwhite":
- return Theme.HighContrastWhite;
- case "hcblack":
- return Theme.HighContrastBlack;
- default:
- return Theme.None;
- }
- }
-
- private void ResetTheme()
- {
- if (SystemParameters.HighContrast)
- {
- Theme highContrastBaseType = GetHighContrastBaseType();
- ChangeTheme(highContrastBaseType);
- }
- else
- {
- string baseColor = WindowsThemeHelper.GetWindowsBaseColor();
- ChangeTheme((Theme)Enum.Parse(typeof(Theme), baseColor));
- }
- }
-
- private void ChangeTheme(Theme theme)
- {
- Theme oldTheme = currentTheme;
- if (theme == currentTheme)
- {
- return;
- }
-
- if (theme == Theme.HighContrastOne)
- {
- ControlzEx.Theming.ThemeManager.Current.ChangeTheme(_app, HighContrastOneTheme);
- currentTheme = Theme.HighContrastOne;
- }
- else if (theme == Theme.HighContrastTwo)
- {
- ControlzEx.Theming.ThemeManager.Current.ChangeTheme(_app, HighContrastTwoTheme);
- currentTheme = Theme.HighContrastTwo;
- }
- else if (theme == Theme.HighContrastWhite)
- {
- ControlzEx.Theming.ThemeManager.Current.ChangeTheme(_app, HighContrastWhiteTheme);
- currentTheme = Theme.HighContrastWhite;
- }
- else if (theme == Theme.HighContrastBlack)
- {
- ControlzEx.Theming.ThemeManager.Current.ChangeTheme(_app, HighContrastBlackTheme);
- currentTheme = Theme.HighContrastBlack;
- }
- else if (theme == Theme.Light)
- {
- ControlzEx.Theming.ThemeManager.Current.ChangeTheme(_app, LightTheme);
- currentTheme = Theme.Light;
- }
- else if (theme == Theme.Dark)
- {
- ControlzEx.Theming.ThemeManager.Current.ChangeTheme(_app, DarkTheme);
- currentTheme = Theme.Dark;
- }
- else
- {
- currentTheme = Theme.None;
- }
-
- ThemeChanged?.Invoke(oldTheme, currentTheme);
- }
-
- private void Current_ThemeChanged(object sender, ThemeChangedEventArgs e)
- {
- ResetTheme();
- }
-
- protected virtual void Dispose(bool disposing)
- {
- if (!_disposed)
- {
- if (disposing)
- {
- ControlzEx.Theming.ThemeManager.Current.ThemeChanged -= Current_ThemeChanged;
- SystemParameters.StaticPropertyChanged -= SystemParameters_StaticPropertyChanged;
- _disposed = true;
- }
- }
- }
-
- public void Dispose()
- {
- Dispose(disposing: true);
- GC.SuppressFinalize(this);
- }
- }
-
- public delegate void ThemeChangedHandler(Theme oldTheme, Theme newTheme);
-
- public enum Theme
- {
- None,
- Light,
- Dark,
- HighContrastOne,
- HighContrastTwo,
- HighContrastBlack,
- HighContrastWhite,
- }
-}
diff --git a/src/modules/launcher/PowerLauncher/Themes/HighContrast1.xaml b/src/modules/launcher/PowerLauncher/Themes/HighContrast1.xaml
index 9a7d803fa5..cb1b0a78ea 100644
--- a/src/modules/launcher/PowerLauncher/Themes/HighContrast1.xaml
+++ b/src/modules/launcher/PowerLauncher/Themes/HighContrast1.xaml
@@ -12,7 +12,6 @@
HighContrast
Accent2
White
- True
#ffff00
diff --git a/src/modules/launcher/PowerLauncher/Themes/HighContrast2.xaml b/src/modules/launcher/PowerLauncher/Themes/HighContrast2.xaml
index 9ee88a06bd..e5562562f3 100644
--- a/src/modules/launcher/PowerLauncher/Themes/HighContrast2.xaml
+++ b/src/modules/launcher/PowerLauncher/Themes/HighContrast2.xaml
@@ -12,7 +12,6 @@
HighContrast
Accent3
White
- True
#ffff00
diff --git a/src/modules/launcher/PowerLauncher/Themes/HighContrastBlack.xaml b/src/modules/launcher/PowerLauncher/Themes/HighContrastBlack.xaml
index 02ef4ea5ff..dc8dc608cc 100644
--- a/src/modules/launcher/PowerLauncher/Themes/HighContrastBlack.xaml
+++ b/src/modules/launcher/PowerLauncher/Themes/HighContrastBlack.xaml
@@ -12,7 +12,6 @@
HighContrast
Accent4
White
- True
#66FFFFFF
diff --git a/src/modules/launcher/PowerLauncher/Themes/HighContrastWhite.xaml b/src/modules/launcher/PowerLauncher/Themes/HighContrastWhite.xaml
index 7630e4ee39..687eca98d1 100644
--- a/src/modules/launcher/PowerLauncher/Themes/HighContrastWhite.xaml
+++ b/src/modules/launcher/PowerLauncher/Themes/HighContrastWhite.xaml
@@ -12,7 +12,6 @@
HighContrast
Accent5
White
- True
#66000000