[FZ Editor] Fix SizeToContent (#12888)

* Fix SizeToContent

* WPF window bugfix

Co-authored-by: Niels Laute <niels9001@hotmail.com>
This commit is contained in:
Niels Laute 2021-08-26 13:27:48 +02:00 committed by GitHub
parent 39d46074d6
commit 7f2c6aa3d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 5 deletions

View File

@ -8,6 +8,7 @@
xmlns:props="clr-namespace:FancyZonesEditor.Properties"
mc:Ignorable="d"
Title=""
Height="196"
MinWidth="360"
BorderThickness="0"
xmlns:ui="http://schemas.modernwpf.com/2019"
@ -17,8 +18,9 @@
Background="{DynamicResource PrimaryBackgroundBrush}"
ResizeMode="NoResize"
WindowStartupLocation="CenterOwner"
ContentRendered="EditorWindow_ContentRendered"
Closed="OnClosed">
<Grid>
<Grid Height="160">
<Grid Height="36"
Background="{DynamicResource SecondaryBackgroundBrush}"
Margin="0,-36,0,0"
@ -31,7 +33,7 @@
VerticalAlignment="Center"
Margin="0,4,0,0" />
</Grid>
<StackPanel Margin="16"
<StackPanel Margin="16" VerticalAlignment="Bottom"
FocusManager.FocusedElement="{Binding ElementName=newZoneButton}">
<local:ClickAutomationEventButton x:Name="newZoneButton"
@ -51,7 +53,7 @@
Click="OnAddZone"
OnClickAutomationValue="{x:Static props:Resources.New_zone_added}" />
<Grid Margin="0,24,0,0">
<Grid Margin="0,24,0,-4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="8" />

View File

@ -59,5 +59,11 @@ namespace FancyZonesEditor
App.Overlay.FocusEditor();
}
}
// This is required to fix a WPF rendering bug when using custom chrome
private void EditorWindow_ContentRendered(object sender, System.EventArgs e)
{
InvalidateVisual();
}
}
}

View File

@ -8,6 +8,7 @@
xmlns:props="clr-namespace:FancyZonesEditor.Properties"
mc:Ignorable="d"
Title=""
Height="176"
MinWidth="360"
BorderThickness="0"
xmlns:ui="http://schemas.modernwpf.com/2019"
@ -17,8 +18,9 @@
Background="{DynamicResource PrimaryBackgroundBrush}"
ResizeMode="NoResize"
WindowStartupLocation="CenterOwner"
ContentRendered="EditorWindow_ContentRendered"
Closed="OnClosed">
<Grid>
<Grid Height="140">
<Grid
Height="36"
Background="{DynamicResource SecondaryBackgroundBrush}"
@ -52,7 +54,7 @@
<Run Text="{x:Static props:Resources.MergeDescription}" />
</TextBlock>
</StackPanel>
<Grid Margin="0,24,0,0">
<Grid Margin="0,24,0,-4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="8"/>

View File

@ -38,5 +38,11 @@ namespace FancyZonesEditor
}
private GridLayoutModel _stashedModel;
// This is required to fix a WPF rendering bug when using custom chrome
private void EditorWindow_ContentRendered(object sender, System.EventArgs e)
{
InvalidateVisual();
}
}
}