AVLN3000: Can't use resource for Foreground property of TextPresenter
styris-ame opened this issue · comments
Describe the bug
See the following XAML using a TextPresenter:
<TextPresenter Text="Test" Foreground="{DynamicResource TextPrimaryBrush}"/>
It gives me this error upon compilation:
Error AVLN3000 : Unable to find suitable setter or adder for property Foreground of type Avalonia.Controls:Avalonia.Controls.Presenters.TextPresenter for argument Avalonia.Base:Avalonia.Data.IBinding, available setter parameter lists are: Avalonia.Media.IBrush Line 68, position 97.
However I can still set the brush like this:
<TextPresenter Text="Test">
<TextPresenter.Foreground>
<SolidColorBrush Color="{DynamicResource TextPrimaryColor}"/>
</TextPresenter.Foreground>
</TextPresenter>
The following works too:
<TextPresenter Text="Test" Foreground="Red"/>
I don't think this matters, but this is my brush resource:
<SolidColorBrush x:Key="TextPrimaryBrush" Color="#191a1a"/>
To Reproduce
Self explanatory
Expected behavior
No response
Avalonia version
11.1.0-beta2
OS
Windows
Additional context
I tested it on another project too, with the same result.
You can't bind to TextPresenter properties. This is a presenter control, designed to be used as a building block of more complex controls (like, TextBox).