Can't change TextElement.Foreground property in Button if accent class is present (Fluent Theme) #19326
-
If I'm specifying the The same is if I'm specifying selector as just However, when I'm removing the Minimal reproducible example of my problemUse Fluent Theme in the app. <Window> <!-- I'll skip here all of the Window's tags -->
<Window.Styles>
<Style Selector="Button.accent">
<Setter Property="TextElement.Foreground" Value="Gray"/>
</Style>
</Window.Styles>
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<Button Classes="accent">Click me!</Button>
</StackPanel>
</Window> ![]() Also creating style for some other class and adding this class to the button doesn't work too. I first thought that maybe Fluent Theme overrides somewhere What is the reason of such a behavior and how can I still style that element? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Please lookup the original styles for button. Most likely there is a dynamic resource to override. Otherwise your selector may need to access some template parts. DevTools can also help ironing out such issues. |
Beta Was this translation helpful? Give feedback.
Here is the relevant part:
Avalonia/src/Avalonia.Themes.Fluent/Controls/Button.xaml
Lines 67 to 91 in aa25441