We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
See the following XAML that uses a binding:
<TextBlock Text="Example"> <TextBlock.Foreground> <SolidColorBrush Opacity="0.5" Color="{Binding ExampleBrush, Converter={StaticResource ToColorConverter}}"/> </TextBlock.Foreground> </TextBlock>
I can use the ToColorConverter to convert extract the Color property from ExampleBrush.
However, I cannot do the same with a resource:
<TextBlock Text="Example"> <TextBlock.Foreground> <SolidColorBrush Opacity="0.5" Color="{DynamicResource ExampleBrush, Converter={StaticResource ToColorConverter}}"/> </TextBlock.Foreground> </TextBlock>
This is particularly annoying when using themes, as I am forced to define both a SolidColorBrush and a Color for certain things.
The ability to use converters with resources, or else an easy way to use a SolidColorBrush resource as a Color.
Defining a Color and a SolidColorBrush for the same actual color.
Avalonia 11.1.0-beta2
The text was updated successfully, but these errors were encountered:
Can you try if that would work for you? Not sure rn but worth a try. {Binding Source={DynamicResource ...}, Converter='...'}
{Binding Source={DynamicResource ...}, Converter='...'}
Sorry, something went wrong.
It says {DynamicResource} can only be used with dependency property
{DynamicResource} can only be used with dependency property
No branches or pull requests
Is your feature request related to a problem? Please describe.
See the following XAML that uses a binding:
I can use the ToColorConverter to convert extract the Color property from ExampleBrush.
However, I cannot do the same with a resource:
This is particularly annoying when using themes, as I am forced to define both a SolidColorBrush and a Color for certain things.
Describe the solution you'd like
The ability to use converters with resources, or else an easy way to use a SolidColorBrush resource as a Color.
Describe alternatives you've considered
Defining a Color and a SolidColorBrush for the same actual color.
Additional context
Avalonia 11.1.0-beta2
The text was updated successfully, but these errors were encountered: