Maximizing a window with a WindowChromeBehavior.IgnoreTaskbarOnMaximize set to false makes it unusable
See original GitHub issueHello,
I have some kind of issue with my custom window and WindowChromeBehavior
.
When not maximized, it runs fine and resizes fine, however, when maximized, a previously fixed problem appears again:
The window gets stuck to the top left corner and is passing clicks through other windows.
This only happens when IgnoreTaskbarOnMaximize
is set to false
.
This does not happen with a normal window, only with my custom one.
Here is a cut version of the template:
<ControlTemplate TargetType="{x:Type controls:ThemedWindow}">
<Grid>
<AdornerDecorator x:Name="Adorner">
<Grid Background="{TemplateBinding Background}">
<Grid.RowDefinitions>
<RowDefinition Height="20"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid x:Name="PART_MoveArea" Background="Transparent">
<Viewbox VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10 1">
<TextBlock Text="{TemplateBinding Title}" />
</Viewbox>
</Grid>
<StackPanel Grid.Row="0" Grid.Column="1" Orientation="Horizontal">
<!-- Title bar buttons -->
</StackPanel>
<ContentPresenter Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="2" Margin="2"/>
</Grid>
</AdornerDecorator>
<ResizeGrip x:Name="WindowResizeGrip"/>
<!-- + usual props -->
<Border BorderThickness="{TemplateBinding BorderThickness}"
BorderBrush="{TemplateBinding BorderBrush}"
Background="{x:Null}"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
</Grid>
<!-- Triggers -->
</ControlTemplate>
And here is the WindowChromeBehavior:
new WindowChromeBehavior
{
IgnoreTaskbarOnMaximize = false,
ResizeBorderThickness = new Thickness(5),
KeepBorderOnMaximize = true,
};
Issue Analytics
- State:
- Created 5 years ago
- Comments:17 (8 by maintainers)
Top Results From Across the Web
Properly maximizing WPF window with WindowStyle=None
The trick is to set the WindowStyle to SingleBorderWindow then maximize the window and set it back to None . Share.
Read more >Full-screen, disable minimize/maximize for .NET MAUI ...
In this post we will learn how to make your .NET MAUI Windows app fullscreen or disable the maximize and minimize button on...
Read more >The Non-Maximizing Maximize Button
One of my great frustrations with the Mac is the way the maximize button on each window fails to maximize the window.
Read more >Adobe Flash Platform * Managing windows
Example: Minimizing, maximizing, restoring and closing a window ... If the visible property is set to false on a minimized window, the dock...
Read more >Form.MaximizeBox Property (System.Windows.Forms)
Maximizing a form at run time generates a Resize event. The WindowState property reflects the current state of the window. If you set...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You can find the source code here: https://github.com/TheMvvmGuys/FindMyGames/tree/ui-updates/FindMyGames/Controls
So i guess we should add some kind of guard to prevent such issues. @punker76 Should we add a check for WindowStyle = None in OnAttached and throw an exception if it’s not already set to None instead of setting it to None there?