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

Can't set properties using style selector #10

Open
StefanKoell opened this issue Jun 6, 2024 · 4 comments
Open

Can't set properties using style selector #10

StefanKoell opened this issue Jun 6, 2024 · 4 comments

Comments

@StefanKoell
Copy link
Contributor

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
Copy link
Contributor Author

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
Copy link
Owner

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
Copy link
Contributor Author

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
Copy link
Contributor Author

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

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

No branches or pull requests

2 participants