diff --git a/Directory.Packages.props b/Directory.Packages.props index 97db311ce0..185b6c2159 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -74,7 +74,7 @@ - + diff --git a/NOTICE.md b/NOTICE.md index b55b8c9f0f..0396e96d8c 100644 --- a/NOTICE.md +++ b/NOTICE.md @@ -1332,5 +1332,5 @@ EXHIBIT A -Mozilla Public License. - Vanara.PInvoke.Shell32 3.4.11 - Vanara.PInvoke.User32 3.4.11 - WinUIEx 2.2.0 -- WPF-UI 3.0.0-preview.4 +- WPF-UI 3.0.0-preview.9 diff --git a/src/common/Common.UI/OSVersionHelper.cs b/src/common/Common.UI/OSVersionHelper.cs new file mode 100644 index 0000000000..8823ceaf85 --- /dev/null +++ b/src/common/Common.UI/OSVersionHelper.cs @@ -0,0 +1,16 @@ +// 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; + +namespace Common.UI +{ + public static class OSVersionHelper + { + public static bool IsWindows11() + { + return Environment.OSVersion.Version.Major >= 10 && Environment.OSVersion.Version.Build >= 22000; + } + } +} diff --git a/src/modules/imageresizer/ui/Views/MainWindow.xaml b/src/modules/imageresizer/ui/Views/MainWindow.xaml index 3627e68d4a..72a5120710 100644 --- a/src/modules/imageresizer/ui/Views/MainWindow.xaml +++ b/src/modules/imageresizer/ui/Views/MainWindow.xaml @@ -16,7 +16,6 @@ ExtendsContentIntoTitleBar="True" Icon="/PowerToys.ImageResizer;component/Resources/ImageResizer.ico" ResizeMode="NoResize" - WindowBackdropType="Mica" WindowCornerPreference="Default" WindowStartupLocation="CenterScreen"> diff --git a/src/modules/imageresizer/ui/Views/MainWindow.xaml.cs b/src/modules/imageresizer/ui/Views/MainWindow.xaml.cs index 0c96ed12a7..9a6dfc15b1 100644 --- a/src/modules/imageresizer/ui/Views/MainWindow.xaml.cs +++ b/src/modules/imageresizer/ui/Views/MainWindow.xaml.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; +using Common.UI; using ImageResizer.ViewModels; using Microsoft.Win32; using Wpf.Ui.Controls; @@ -17,7 +18,17 @@ namespace ImageResizer.Views public MainWindow(MainViewModel viewModel) { DataContext = viewModel; - Wpf.Ui.Appearance.Watcher.Watch(this); + Wpf.Ui.Appearance.SystemThemeWatcher.Watch(this); + + if (OSVersionHelper.IsWindows11()) + { + WindowBackdropType = WindowBackdropType.Mica; + } + else + { + WindowBackdropType = WindowBackdropType.None; + } + InitializeComponent(); } diff --git a/src/settings-ui/Settings.UI.Library/Utilities/Helper.cs b/src/settings-ui/Settings.UI.Library/Utilities/Helper.cs index 7c4070b209..4f75ae6a25 100644 --- a/src/settings-ui/Settings.UI.Library/Utilities/Helper.cs +++ b/src/settings-ui/Settings.UI.Library/Utilities/Helper.cs @@ -150,10 +150,5 @@ namespace Microsoft.PowerToys.Settings.UI.Library.Utilities } public const uint VirtualKeyWindows = interop.Constants.VK_WIN_BOTH; - - public static bool Windows11() - { - return Environment.OSVersion.Version.Major >= 10 && Environment.OSVersion.Version.Build >= 22000; - } } } diff --git a/src/settings-ui/Settings.UI/ViewModels/AlwaysOnTopViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/AlwaysOnTopViewModel.cs index 184ef0d600..8df6bfa896 100644 --- a/src/settings-ui/Settings.UI/ViewModels/AlwaysOnTopViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/AlwaysOnTopViewModel.cs @@ -6,6 +6,7 @@ using System; using System.Globalization; using System.Runtime.CompilerServices; using System.Text.Json; +using Common.UI; using global::PowerToys.GPOWrapper; using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.Library.Helpers; @@ -61,7 +62,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels _doNotActivateOnGameMode = Settings.Properties.DoNotActivateOnGameMode.Value; _roundCornersEnabled = Settings.Properties.RoundCornersEnabled.Value; _excludedApps = Settings.Properties.ExcludedApps.Value; - _windows11 = Helper.Windows11(); + _windows11 = OSVersionHelper.IsWindows11(); // set the callback functions value to handle outgoing IPC message. SendConfigMSG = ipcMSGCallBackFunc; diff --git a/src/settings-ui/Settings.UI/ViewModels/FancyZonesViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/FancyZonesViewModel.cs index 428730370c..2ce6a47b52 100644 --- a/src/settings-ui/Settings.UI/ViewModels/FancyZonesViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/FancyZonesViewModel.cs @@ -4,6 +4,7 @@ using System; using System.Runtime.CompilerServices; +using Common.UI; using global::PowerToys.GPOWrapper; using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.Library.Helpers; @@ -119,7 +120,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels InitializeEnabledValue(); - _windows11 = Helper.Windows11(); + _windows11 = OSVersionHelper.IsWindows11(); // Disable setting on windows 10 if (!_windows11 && DisableRoundCornersOnWindowSnap) diff --git a/src/settings-ui/Settings.UI/ViewModels/Flyout/FlyoutViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/Flyout/FlyoutViewModel.cs index d97237c43f..4b77b1dce6 100644 --- a/src/settings-ui/Settings.UI/ViewModels/Flyout/FlyoutViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/Flyout/FlyoutViewModel.cs @@ -6,6 +6,7 @@ using System; using System.ComponentModel; using System.Runtime.CompilerServices; using System.Timers; +using Common.UI; using Microsoft.PowerToys.Settings.UI.Library.Utilities; namespace Microsoft.PowerToys.Settings.UI.ViewModels.Flyout @@ -39,7 +40,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels.Flyout _hideTimer.Elapsed += HideTimer_Elapsed; _hideTimer.Interval = 1000; _hideTimer.Enabled = false; - _windows10 = !Helper.Windows11(); + _windows10 = !OSVersionHelper.IsWindows11(); } private void HideTimer_Elapsed(object sender, ElapsedEventArgs e)