I have a RadButton and an image (SVG) inside it and I want to be able to apply tint color to it.
The community toolkit provides IconTintColor behavior: https://learn.microsoft.com/en-us/dotnet/communitytoolkit/maui/behaviors/icon-tint-color-behavior
Background property is not applied on Android and WinUI. On Mac and iOS works as expected.
<telerik:RadButton x:Name="button" Text="hello telerik button">
<telerik:RadButton.Background>
<LinearGradientBrush EndPoint="0,1">
<GradientStop Offset="0.0" Color="Violet" />
<GradientStop Offset="1.0" Color="DarkRed" />
</LinearGradientBrush>
</telerik:RadButton.Background>
</telerik:RadButton>
Setting Text property of RadButton like this:
this.myButton.Text = "4" + Environment.NewLine + "Totals Files";
And applying HorizontalContentAlignment to "Center" leads to different result on Android and Windows:
When I try to change the background image on a button click, the image is not changed
<telerik:RadButton Grid.Row="6" BackgroundImage="image.png" VerticalOptions="Center" HorizontalOptions="Center" WidthRequest="100" HeightRequest="100" Clicked="RadButton_Clicked"/>
private void RadButton_Clicked(object sender, EventArgs e)
{
(sender as Telerik.Maui.Controls.RadButton).BackgroundImage = "image2.png";
}
BackgroundColor is not applied property when DynamicResource is used and button enabling state is changed
<Style TargetType="telerik:RadButton" x:Key="MyTelerikButtonStyle">
<Setter Property="TextColor" Value="{DynamicResource MyPrimaryColor}" />
<Setter Property="BackgroundColor" Value="{DynamicResource MySecondaryColor}" />
<Style.Triggers>
<Trigger TargetType="telerik:RadButton" Property="IsEnabled" Value="false" >
<Setter Property="BackgroundColor" Value="Gray" />
</Trigger>
</Style.Triggers>
</Style>
WORKAROUND:
Use StaticResource:
<Setter Property="TextColor" Value="White" />
<Setter Property="BackgroundColor" Value="Green" />