New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On Windows 8 a window with height 23px resizes to 39px after dragging #2066

Closed
digimezzo opened this Issue Aug 4, 2015 · 1 comment

Comments

Projects
None yet
2 participants
@digimezzo

digimezzo commented Aug 4, 2015

I've bumped into a peculiar issue. I've written a small application which demonstrates it: https://www.dropbox.com/s/jndzb2f5ctf8ulf/Mahapps_WindowHeight_Issue.zip?dl=0

This demo application is using MetroWindow (Mahapps Metro 1.1.2) and has a window height=23px when it starts. If you reposition the window by dragging with the mouse, the window height jumps to 39px by itself.
This issue doesn't happen on windows 7, but it does on windows 8. Useful to know: it happens on windows 8 when the performance options are configured as "adjust for best appearance", it doesn't happen when they're configured as "adjust for best performance".

Also useful: 39px is the minimum window height possible when a window has a WindowStyle (I have not found any docs on that, but discovered it by trial and error). A height lower than 39px can only be achieved when WindowStyle=None.

Could it be that dragging the window suddenly restores the WindowStyle?

Edit: I've pinpointed the performance setting which causes this: "Animate windows when minimizing and maximizing"

@punker76

This comment has been minimized.

Show comment
Hide comment
@punker76

punker76 Mar 13, 2017

Member

Here some Infos about this issue:

  • MahApps use always WindowStyle="None" (it is explicit set in BorderlessWindowBehavior
  • MahApps enhanced the WindowChrome and WindowChromeWorker to achieve the animation of the window itself together with the WindowStyle="None" setting
  • This causes the window height issue
  • The BorderlessWindowBehavior has now a fix to solve this
  • It's recommended to set always the MaxHeight too!

A sample

<controls:MetroWindow x:Class="MainWindow"
                      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                      xmlns:controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
                      Title="MainWindow"
                      BorderThickness="0"
                      Height="23"
                      MaxHeight="23"
                      TitlebarHeight="23"
                      ShowTitleBar="False"
                      IsWindowDraggable="True"
                      Background="Wheat"
                      Width="400"
                      ResizeMode="CanMinimize">
    <Grid />
</controls:MetroWindow>

image

Member

punker76 commented Mar 13, 2017

Here some Infos about this issue:

  • MahApps use always WindowStyle="None" (it is explicit set in BorderlessWindowBehavior
  • MahApps enhanced the WindowChrome and WindowChromeWorker to achieve the animation of the window itself together with the WindowStyle="None" setting
  • This causes the window height issue
  • The BorderlessWindowBehavior has now a fix to solve this
  • It's recommended to set always the MaxHeight too!

A sample

<controls:MetroWindow x:Class="MainWindow"
                      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                      xmlns:controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
                      Title="MainWindow"
                      BorderThickness="0"
                      Height="23"
                      MaxHeight="23"
                      TitlebarHeight="23"
                      ShowTitleBar="False"
                      IsWindowDraggable="True"
                      Background="Wheat"
                      Width="400"
                      ResizeMode="CanMinimize">
    <Grid />
</controls:MetroWindow>

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment