question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Maximizing a window with a WindowChromeBehavior.IgnoreTaskbarOnMaximize set to false makes it unusable

See original GitHub issue

Hello,

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: image 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:closed
  • Created 5 years ago
  • Comments:17 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
jeuxjeux20commented, Jan 16, 2019
0reactions
batzencommented, Jan 19, 2019

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?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found