Skip to content

Mica material: Incorrect margin values after maximize window not through the button. #167

@Ladsers

Description

@Ladsers

Describe the bug

If you maximize the window not through the "Maximize" button, but by dragging the window to the top of the screen, then the margin values of the elements decrease. Also, if you return from full screen mode not through the "Maximize" button, but through "Win + ↓", then the margin values will increase.

If you do not use "Miсa", then everything is fine.

Steps to reproduce the bug

  1. Implement window:
<hc:Window x:Class="HandyControlsDemo1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:hc="https://handyorg.github.io/handycontrol"
        mc:Ignorable="d"
        SystemBackdropType="Mica"
        Title="MainWindow" Height="250" Width="425">
    <Grid>
        <StackPanel Orientation="Vertical" VerticalAlignment="Bottom">
            <DockPanel HorizontalAlignment="Stretch">
                <Button Content="Button1" Margin="10" HorizontalAlignment="Left"/>
                <Button Content="Button2" Margin="10" HorizontalAlignment="Right"/>
            </DockPanel>
        </StackPanel>
    </Grid>
</hc:Window>
  1. Press "Win + ↑" to maximize window (or drag the window to the top of the screen).
  2. Press "Win + ↓" to back to small window.

Expected behavior

The margin values of the elements remain the same.

Screenshots

"Good" window (initial state):

good

"Bad" window after "Win + ↑":

bad_max

"Good" window after clicking on the maximize button:

good_max

"Bad" window after "Win + ↓" (purposefully moved the cursor to the close button):

bad

NuGet package version

HandyControl 3.4.0

IDE

No response

Framework type

.Net Framework 4.8

Windows version

Windows 11 (22000)

Additional context

HandyControls: 3.4.2
IDE: JetBrains Rider 2021.3.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions