davidxuang / FluentIcons

A multi-framework wrapper of https://github.com/microsoft/fluentui-system-icons
MIT License
72 stars 6 forks source link

Can't set properties using style selector #10

Closed StefanKoell closed 1 month ago

StefanKoell commented 2 months ago

Hi!

I see a weird issue where I'm unable to use a simple style selector on the SymbolIcon to set a property (like FontSize). I get a message like: Error AVLN3000 Avalonia: FontSize is not an AvaloniaProperty Line 16, position 17.

Looking at the source code, I can see that the FontSize property is a "styled property". Is this an issue with Avalonia or the SymbolIcon or am I missing something?

Thanks, Stefan

StefanKoell commented 2 months ago

I think I know what's going on. The markup extension is named SymbolIconExtension and then there's the class SymbolIcon. I guess the issue is that the XAML compiler has a "convention" which makes markup extensions available in XAML without the need to provide the ...Extension suffix (if you name that class using the Extension suffix. So it seems after removing the suffix, we end up with two identical class names which gets the XAML compiler confused.

davidxuang commented 2 months ago

I think I know what's going on. The markup extension is named SymbolIconExtension and then there's the class SymbolIcon. I guess the issue is that the XAML compiler has a "convention" which makes markup extensions available in XAML without the need to provide the ...Extension suffix (if you name that class using the Extension suffix. So it seems after removing the suffix, we end up with two identical class names which gets the XAML compiler confused.

Markup Extensions were added just this release, so your code did work for 1.1.240?

StefanKoell commented 2 months ago

I can't really tell because I just started with styling and didn't do it before I used the markup extensions. I'm currently investigating and let you know tomorrow. Maybe I can also create a PR.

StefanKoell commented 2 months ago

Hi David!

I found a couple of issues which prevented style selectors to set property values. See #11

Would be great if you can accept the PR. If you want me to change anything, let me know.

cheers, Stefan

davidxuang commented 1 month ago

Close for now. Re-open for more related questions.