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

[RFC] Icon scaling #2667

Merged
merged 5 commits into from Oct 9, 2016

Conversation

Projects
None yet
2 participants
@thoemmi
Collaborator

thoemmi commented Sep 23, 2016

This PR adds the property IconScalingMode to MetroWindow. It's forwarded to MultiFrameImage.MultiFrameImageMode to set the icon scaling. There are two possible values:

  • MultiFrameImageMode.ScaleDownLargerFrame

    It takes the smallest frame which from the icon which has equal or larger size as the window's icon template. The frame is scaled down it's larger.

    image
  • MultiFrameImageMode.NoScaleSmallerFrame

    It takes the largest frame from the window which has equal or smaller size than the window's icon template. The frame is rendered centered if it's smaller.

    image

I've added two menu items to the Window menu in the demo application.

I created a special icon for reproduction, but didn't want include it in this PR. Just replace Mahapps.Metro.Tests\mahapps.metro.logo2.ico with the icon in this ZIP file.

RFC: I'm not satisfied with the naming of the properties and the enum. If you have a better suggestion I would be happy to rename them.

This fixes #2242.

@thoemmi thoemmi added the Enhancement label Sep 23, 2016

@punker76 punker76 added this to the 1.4.0 milestone Sep 23, 2016

@punker76

This comment has been minimized.

Show comment
Hide comment
@punker76

punker76 Oct 8, 2016

Member

@thoemmi I want to merge this PR with these namings...

For MetroWindow

IconMultiFrameScalingMode -> type IconMultiFrameScalingModes

For MultiFrameImage

MultiFrameScalingMode -> type IconMultiFrameScalingModes

public enum IconMultiFrameScalingModes {
    ScaleDownLargerFrame,
    NoScaleSmallerFrame,
}
Member

punker76 commented Oct 8, 2016

@thoemmi I want to merge this PR with these namings...

For MetroWindow

IconMultiFrameScalingMode -> type IconMultiFrameScalingModes

For MultiFrameImage

MultiFrameScalingMode -> type IconMultiFrameScalingModes

public enum IconMultiFrameScalingModes {
    ScaleDownLargerFrame,
    NoScaleSmallerFrame,
}
@thoemmi

This comment has been minimized.

Show comment
Hide comment
@thoemmi

thoemmi Oct 8, 2016

Collaborator

I recommend staying with singular IconMultiFrameScalingMode. See Enumeration Type Naming Guidelines: as long as it's not a bitfield (annotated with FlagsAttribute), it should use a singular name, because there's always only one mode active.

The enum is called MultiFrameImageMode because it is used by MultiFrameImage. That MetroWindow is using the control to display the icon is secondary. Therefore I hesitate to prefix the enum's name with Icon.

Collaborator

thoemmi commented Oct 8, 2016

I recommend staying with singular IconMultiFrameScalingMode. See Enumeration Type Naming Guidelines: as long as it's not a bitfield (annotated with FlagsAttribute), it should use a singular name, because there's always only one mode active.

The enum is called MultiFrameImageMode because it is used by MultiFrameImage. That MetroWindow is using the control to display the icon is secondary. Therefore I hesitate to prefix the enum's name with Icon.

@punker76 punker76 merged commit 0edf833 into develop Oct 9, 2016

1 check passed

continuous-integration/teamcity Finished TeamCity Build MahApps.Metro PullRequest :: MahApps.Metro PullRequests : Tests passed: 59
Details

@thoemmi thoemmi deleted the issue2242-icon-scaling branch Oct 9, 2016

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