Skip to content
New issue

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

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

Already on GitHub? # to your account

Maximize button only displays partially when using SaveWindowPosition #1580

Closed
ghost opened this issue Oct 14, 2014 · 2 comments
Closed

Maximize button only displays partially when using SaveWindowPosition #1580

ghost opened this issue Oct 14, 2014 · 2 comments
Labels
Milestone

Comments

@ghost
Copy link

ghost commented Oct 14, 2014

reproducable in 0.14 and 0.15.0 ALPHA41

Create a basic MetroWindow and set SaveWindowPosition to true.
Include at least the Controls (<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />). Launch the application and now maximize the window. Note that the maximize button looks correct (like this):
good

Close the application (while it is maximized) and launch it again (so it opens maximized).
The maximize button now looks like this:
fail

If you change the window mode and then restore to maximum size, the icon will display correctly again.
It only happens when SaveWindowPosition is set to true and the window's last state was maximized.

Using WindowState="Maximized" on the other hand works correctly (also in conjunction with SaveWindowPosition).

@grokys
Copy link
Contributor

grokys commented Dec 4, 2014

Some information I found investigating:

This problem is caused by the fact that the contentPresenter in PART_Max is starting with a size of 9,9 where it needs to be 10,10. Restoring the window leaves it at 9,9, but that's not a problem as the Maximize icon fits that size - maximizing again resets it to its correct value of 10,10

It appears that MaxPath is being measured incorrectly- it's DesiredSize is reporting 10,10 but contentPresenter's DesiredSize is 9,9.

A workaround could be to set MaxPath's Width and Height explicitly:

<Path x:Name="MaxPath" SnapsToDevicePixels="True" Width="10" Height="10" Fill="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType=Button}}" />

Or in the trigger that sets the Path.Data.

Let me know if this is an acceptable solution and I will prepare a pull-request.

@ghost
Copy link
Author

ghost commented Dec 4, 2014

Yeah, you are right, it does fix it.

I don't know whether MahApps supports radical restyling to the point where the maximize button would be of a totally different size, but for all the default styles (which are just different colors) it works without issues.

@punker76 punker76 added this to the 1.0.1 milestone Dec 4, 2014
@punker76 punker76 added the Bug label Dec 4, 2014
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Development

No branches or pull requests

2 participants