Skip to content
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
Merged

[RFC] Icon scaling #2667

merged 5 commits into from
Oct 9, 2016

Conversation

thoemmi
Copy link
Collaborator

@thoemmi 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.

@punker76 punker76 added this to the 1.4.0 milestone Sep 23, 2016
@punker76
Copy link
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
Copy link
Collaborator Author

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
@thoemmi thoemmi deleted the issue2242-icon-scaling branch October 9, 2016 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Add padding to window icons
2 participants