SKProCH/Material.Icons

Remove hard coded width and/or height from default wpf style

isak1080 opened this issue · 2 comments

The current default style for the <wpf:MaterialIcon /> has a hard coded width and height of 16 pixels.

  • The icons are not all in 1:1 aspect ratio, so the actual size may not be what you specify (e.g. if the icon is wider then the icon height will not be 16 but a smaller number)
  • When using the control and specifying the size, you have to specify both width and height to actually get any effect.

It would be better if the default Width and/or Height where actually Double.NaN. That way, the icons will scale to whatever the parent control allows, and if I want to restrict it further, I can just set either Width or (more realistically) Height to whatever makes sense for that usage.

For reference, this is the style I apply globally in my apps to work around this:

<Style TargetType="{x:Type wpf:MaterialIcon}" >
    <Setter Property="Height" Value="NaN" />
    <Setter Property="Width" Value="NaN" />
</Style>

Hello, @isak1080

What do you think, maybe i should remove HorizontalAlignment and VerticalAlignment from the default template too?

I haven't been bothered by them, but yeah, it's probably a good idea to remove them as well and fallback to whatever default WPF has