diff --git a/src/settings-ui/Settings.UI/Helpers/NativeMethods.cs b/src/settings-ui/Settings.UI/Helpers/NativeMethods.cs index 4bb0b1a7f9..c895866c1e 100644 --- a/src/settings-ui/Settings.UI/Helpers/NativeMethods.cs +++ b/src/settings-ui/Settings.UI/Helpers/NativeMethods.cs @@ -10,8 +10,9 @@ namespace Microsoft.PowerToys.Settings.UI.Helpers { public static class NativeMethods { - private const int GWL_STYLE = -16; private const int WS_POPUP = 1 << 31; // 0x80000000 + internal const int GWL_STYLE = -16; + internal const int WS_CAPTION = 0x00C00000; internal const int SPI_GETDESKWALLPAPER = 0x0073; internal const int SW_SHOWNORMAL = 1; internal const int SW_SHOWMAXIMIZED = 3; diff --git a/src/settings-ui/Settings.UI/SettingsXAML/FlyoutWindow.xaml b/src/settings-ui/Settings.UI/SettingsXAML/FlyoutWindow.xaml index 7f9b221bcf..d6a6f6f2f8 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/FlyoutWindow.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/FlyoutWindow.xaml @@ -4,8 +4,6 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:flyout="using:Microsoft.PowerToys.Settings.UI.Flyout" - xmlns:i="using:Microsoft.Xaml.Interactivity" - xmlns:ic="using:Microsoft.Xaml.Interactions.Core" xmlns:local="using:Microsoft.PowerToys.Settings.UI" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:winuiex="using:WinUIEx" @@ -29,17 +27,6 @@ LightTintOpacity="0" /> - - - - - - - - diff --git a/src/settings-ui/Settings.UI/SettingsXAML/FlyoutWindow.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/FlyoutWindow.xaml.cs index 1835f474a1..27a20540c9 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/FlyoutWindow.xaml.cs +++ b/src/settings-ui/Settings.UI/SettingsXAML/FlyoutWindow.xaml.cs @@ -28,6 +28,13 @@ namespace Microsoft.PowerToys.Settings.UI public FlyoutWindow(POINT? initialPosition) { this.InitializeComponent(); + + // Remove the caption style from the window style. Windows App SDK 1.6 added it, which made the title bar and borders appear for the Flyout. This code removes it. + var hwnd = WinRT.Interop.WindowNative.GetWindowHandle(this); + var windowStyle = NativeMethods.GetWindowLong(hwnd, NativeMethods.GWL_STYLE); + windowStyle &= ~NativeMethods.WS_CAPTION; + _ = NativeMethods.SetWindowLong(hwnd, NativeMethods.GWL_STYLE, windowStyle); + this.Activated += FlyoutWindow_Activated; FlyoutAppearPosition = initialPosition; ViewModel = new FlyoutViewModel(); diff --git a/src/settings-ui/Settings.UI/ViewModels/Flyout/FlyoutViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/Flyout/FlyoutViewModel.cs index 4b77b1dce6..a8cb2474aa 100644 --- a/src/settings-ui/Settings.UI/ViewModels/Flyout/FlyoutViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/Flyout/FlyoutViewModel.cs @@ -3,11 +3,7 @@ // See the LICENSE file in the project root for more information. 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 { @@ -18,21 +14,6 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels.Flyout public bool CanHide { get; set; } - private bool _windows10; - - public bool Windows10 - { - get => _windows10; - set - { - if (_windows10 != value) - { - _windows10 = value; - OnPropertyChanged(); - } - } - } - public FlyoutViewModel() { CanHide = true; @@ -40,7 +21,6 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels.Flyout _hideTimer.Elapsed += HideTimer_Elapsed; _hideTimer.Interval = 1000; _hideTimer.Enabled = false; - _windows10 = !OSVersionHelper.IsWindows11(); } private void HideTimer_Elapsed(object sender, ElapsedEventArgs e) @@ -56,13 +36,6 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels.Flyout _hideTimer.Start(); } - public event PropertyChangedEventHandler PropertyChanged; - - private void OnPropertyChanged([CallerMemberName] string propertyName = null) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } - public void Dispose() { Dispose(true);