mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 02:36:19 +02:00
[Settings]WinAppSDK 1.6 Flyout Fix (#34821)
Fixed titlebar and reverted W10 border hack
This commit is contained in:
committed by
GitHub
parent
5b0f3f64d4
commit
7640258c10
@@ -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" />
|
||||
</winuiex:WindowEx.Backdrop>
|
||||
<Grid>
|
||||
<!-- HACK: https://github.com/microsoft/microsoft-ui-xaml/issues/7629 -->
|
||||
<!-- W11 grey border, W10: no border -->
|
||||
<i:Interaction.Behaviors>
|
||||
<ic:DataTriggerBehavior
|
||||
Binding="{x:Bind ViewModel.Windows10}"
|
||||
ComparisonCondition="Equal"
|
||||
Value="True">
|
||||
<ic:ChangePropertyAction PropertyName="BorderThickness" Value="1" />
|
||||
<ic:ChangePropertyAction PropertyName="BorderBrush" Value="{ThemeResource SurfaceStrokeColorDefaultBrush}" />
|
||||
</ic:DataTriggerBehavior>
|
||||
</i:Interaction.Behaviors>
|
||||
<flyout:ShellPage x:Name="FlyoutShellPage" />
|
||||
</Grid>
|
||||
</winuiex:WindowEx>
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user