Replies: 1 comment 10 replies
-
Hmm, its actually interesting idea, i like it. Be we can't remove Height and Width since it avalonia control base properties. |
Beta Was this translation helpful? Give feedback.
10 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
Icons have static size, currently 24x24.
By default, this is not a good design, because some elements may grow and outscale the text, for example MenuItem or small buttons and potential break the design.
We can of course use classes and/or manual size, but defining this every time is ugly, when should be the other way around (Only define it where needed).
Most of times we use icons inside constrained containers, eg: Buttons, Menus, TextBlock and other controls that already define their height by the content.
See this example (3 buttons with a StackPanel[Icon Text]):

To match text I would have to either have classes or manual set size for each icon (Ugly by default)
Solution
Size it to the parent FontSize it's IMO the most correct approach, other icon libraries do that and I never encounter a problem nor the need of set any of the icons with manual size. And to be correct in design terms we want to align icons with text.
The implementation would translate to:
Results in:
So it now respects parent FontSize (12 / 15 / 28, in this example) and Icon integrates much better.
For the rare cases we want to override this, we pass the
FontSize
for Icon.I can submit a PR but would like to ask first. As this is a breaking change. Height and Width would no longer exists in favor of FontSize, just like MaterialIconExt does...
Beta Was this translation helpful? Give feedback.
All reactions