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

Button Icon resizing #286

Closed
wants to merge 1 commit into from
Closed

Button Icon resizing #286

wants to merge 1 commit into from

Conversation

HendrikLynx
Copy link

My first attempt to add a new property;
Added IconHeight and IconWidth parameter, with default value 32, to Fluent:Button to allow resizing of the icon.

Two warnings before pulling:

  1. I'm not sure as to why adding the IconHeight / IconWidth parameter to the Fluent:Button line results in a 'value not valid for parameter' warning. Instead, it adds the new parameters as ints seperately, like the following example. I'm guessing it has to do with the typecast to int, which I assume is required for the value to be correctly used?
<Fluent:Button Name="btnStuff" Header="Stuff" Icon="Images\Icon1.png" LargeIcon="Images\Icon1.png">
    <Fluent:Button.IconWidth>
        <System:Int32>32</System:Int32>
    </Fluent:Button.IconWidth>
    <Fluent:Button.IconHeight>
        <System:Int32>32</System:Int32>
    </Fluent:Button.IconHeight>
</Fluent:Button>

Any pointers on how this behaviour can be changed?

  1. Setting the Button size (Large / Medium / Small) doesn't change the IconHeight / IconWidth value. I'm not sure where to fix this.

Any pointers are welcome.

Added IconHeight and IconWidth parameter, with default value 32, to
Fluent:Button to allow resizing of the icon.
@batzen
Copy link
Member

batzen commented Mar 24, 2016

Hi Hendrik,

i don't get what you are trying to achieve here.
Whats the use case for these properties?

What about all other controls containing icons?
What about QuickAccess items?
What about Icon and LargeIcon? Should there be a difference or should both use the given IconWidth and IconHeight?
What about SizeDefinition and current size?
What about the header? If size of the icon is larger than 32 it gets cut or disappears completely.

The current code is quite simple:
Size = Large: Icon = 32x32
Size = Middle: Icon = 16x16
Size = Small: Icon = 16x16

  1. Properties reflecting sizes should be of type double in WPF.
  2. Why should setting the button size use your new properties? The current code does not know about your properties.

@HendrikLynx
Copy link
Author

I had two usecases in mind.

  1. When you have an application with only a few icons that's going to be used on large screens.
  2. When you want to have a rectangular shaped icon in your application.

Assume that you have an application that only requires a few buttons and tabs. When having a big screen, the 32x32 icon of the Large button size might not cut it. Specially not when pairing with a single line header.
So instead, I wanted to have the possibility of overruling the iconsize. Having a one-line header, consisting of a key word only, really looks awesome when paired with a 48x48 icon.

Instead of adding another Button type, I went with the IconHeight / IconWidth size, to also allow the possibility of having a differently shaped icon, in the form of 32x48 for example.

I haven't thought about the other icons yet, mainly because I haven't used those controls yet.
I'll also change the ints to doubles as suggested.

@batzen
Copy link
Member

batzen commented Mar 24, 2016

Ok, now i get it.

I would suggest you wait till the vote from #282 is over and i finished removing the office 2010 and windows 8 themes, which is the currently most voted option. I will move nearly every xaml file to a different location during the removal and that would make a merge of your PR nearly impossible.

Aside from that i would implement an interface for controls which provide a LargeIcon so you can extend that interface later to add your then named properties LargeIconWidth and LargeIconHeight.

What do you think?

@HendrikLynx
Copy link
Author

Sounds like a good idea. I'll cancel this PR tomorrow, and will fork once you have made said changes.
thumbs up

@batzen
Copy link
Member

batzen commented Mar 25, 2016

Could you create an issue for this so that we can keep track of it and i don't forget it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants