I am trying to customize the appearance of a RadioButton in .NET MAUI, with the goal of dynamically changing the text color based on its selection state (Checked/Unchecked) and using the button's background as a visual indicator for selection. However, I encountered a challenge: I cannot apply the text color directly to the container element (like a Grid or Border) because they do not have a TextColor property.
How can I achieve this effect while ensuring the RadioButton has no checkmark or other icon?
Any help would be greatly appreciated!
<Style TargetType="RadioButton" x:Key="WizardRadioButton">
<Setter Property="FontFamily" Value="Inter-Bold"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="Margin" Value="0,6,0,6"/>
<Setter Property="MinimumHeightRequest" Value="44"/>
<Setter Property="MinimumWidthRequest" Value="44"/>
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource White}}"/>
<Setter Property="BackgroundColor" Value="Transparent"/>
<Setter Property="ControlTemplate">
<Setter.Value>
<ControlTemplate>
<Border StrokeThickness="0"
Stroke="Transparent"
Padding="10,5"
BackgroundColor="Transparent"
StrokeShape="RoundRectangle 8">
<ContentPresenter VerticalOptions="Center"
HorizontalOptions="Center"/>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CheckedStates">
<VisualState x:Name="Checked">
<VisualState.Setters>
<Setter Property="BackgroundColor" Value="#1CB41C"/>
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Unchecked">
<VisualState.Setters>
<Setter Property="BackgroundColor" Value="White"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

CheckedChangedevent could also do the job. More info, you can refer to RadioButton