[PTRun]Fix WPF transparent border issue on Windows 10 (#36392)

* Added border on W10

* Added a comment

---------
Co-authored-by: Davide Giacometti <25966642+davidegiacometti@users.noreply.github.com>
This commit is contained in:
Ionuț Manța
2024-12-18 03:41:19 -08:00
committed by GitHub
parent feeeec644c
commit 6f23fb503b
2 changed files with 101 additions and 94 deletions

View File

@@ -27,6 +27,7 @@
WindowStartupLocation="Manual" WindowStartupLocation="Manual"
WindowStyle="None" WindowStyle="None"
mc:Ignorable="d"> mc:Ignorable="d">
<Border x:Name="MainBorder" BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}">
<Grid x:Name="RootGrid" MouseDown="OnMouseDown"> <Grid x:Name="RootGrid" MouseDown="OnMouseDown">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
@@ -130,6 +131,7 @@
Visibility="{Binding Results.Visibility}" /> Visibility="{Binding Results.Visibility}" />
</Grid> </Grid>
</Border>
<Window.InputBindings> <Window.InputBindings>
<KeyBinding Key="Escape" Command="{Binding EscCommand}" /> <KeyBinding Key="Escape" Command="{Binding EscCommand}" />
<KeyBinding Key="Enter" Command="{Binding OpenResultWithKeyboardCommand}" /> <KeyBinding Key="Enter" Command="{Binding OpenResultWithKeyboardCommand}" />

View File

@@ -200,6 +200,11 @@ namespace PowerLauncher
DWM_WINDOW_CORNER_PREFERENCE preference = DWM_WINDOW_CORNER_PREFERENCE.DWMWCP_ROUND; DWM_WINDOW_CORNER_PREFERENCE preference = DWM_WINDOW_CORNER_PREFERENCE.DWMWCP_ROUND;
DwmSetWindowAttribute(hWnd, attribute, ref preference, sizeof(uint)); DwmSetWindowAttribute(hWnd, attribute, ref preference, sizeof(uint));
} }
else
{
// On Windows10 ResizeMode="NoResize" removes the border so we add a new one.
MainBorder.BorderThickness = new System.Windows.Thickness(0.5);
}
} }
private void OnLoaded(object sender, RoutedEventArgs e) private void OnLoaded(object sender, RoutedEventArgs e)