Xamarin.Forms
Xamarin.Forms copied to clipboard
[Bug] Color of FontImageSource does not change when Button is disabled
Description
When a button which contains a FontImageSource and a text is disabled, only the text takes a different disabled color, not the fontImageSource.
Steps to Reproduce
- Create a button with an FontImageSource as the ImageSource and a text
- Disable the button
- The color of the text is changed but not the color of the icon of the FontImageSource
Expected Behavior
Both the text and the icon should have the same disabled color.
Actual Behavior
Only the text has a disabled color, not the icon.
Basic Information
- Version with issue: Xamarin Forms 4.1
- IDE: VS 2019
Screenshots

@TechWatching Can you please attach a small project that demonstrates this issue? Thanks!
I don't know how @TechWatching has set up his button, but I've got a similar issue. I've bound the color of the fontimagesource to the button TextColor, and when the button is disabled I'm assuming that the button text color isn't actually changing, it's just done in the renderer part? With the code below, the image in the button will always be red, and the text will switch from red to dark grey when the button is disabled.
<StackLayout>
<!-- Place new controls here -->
<Label HorizontalOptions="Center" Text="Button enabled?" />
<Switch x:Name="DisableButtons" HorizontalOptions="Center" IsToggled="True" />
<Button x:Name="ActionButton"
CornerRadius="0"
FontSize="26"
IsEnabled="{Binding Source={x:Reference DisableButtons}, Path=IsToggled}"
Text="Material Button"
TextColor="Red"
Visual="Material">
<Button.ImageSource>
<FontImageSource FontFamily="Roboto-Black"
Glyph="A"
Size="26"
Color="{Binding Source={x:Reference ActionButton}, Path=TextColor}" />
</Button.ImageSource>
</Button>
</StackLayout>
A workaround is using a trigger to have a different FontImageSource depending on the button state, ie something like this:
<Button x:Name="ActionButton"
CornerRadius="0"
FontSize="26"
IsEnabled="{Binding Source={x:Reference DisableButtons}, Path=IsToggled}"
Text="Material Button"
TextColor="Red"
Visual="Material">
<Button.Triggers>
<Trigger TargetType="Button" Property="IsEnabled" Value="False">
<Setter Property="ImageSource">
<FontImageSource FontFamily="Roboto-Black"
Glyph="A"
Size="26"
Color="Gray" />
</Setter>
</Trigger>
</Button.Triggers>
<Button.ImageSource>
<FontImageSource FontFamily="Roboto-Black"
Glyph="A"
Size="26"
Color="{Binding Source={x:Reference ActionButton}, Path=TextColor}" />
</Button.ImageSource>
</Button>
Doesn't necessarily match the text color but at least it looks disabled.
Yes exactly the same problem and the same workaround.
Still present on MAUI unfortunately