Hello,
Welcome to our Microsoft Q&A platform!
So my question is, is there a way in the code behind to set the property for the FlyoutItemLabel TextColor in the code behind, since it appears that customizing through the XAML isn't working/binding? Thanks!
You can use DynamicResource
to change FlyoutItemLabel
TextColor by code behind.
Firstly, you need to create Color resource in App.xaml.
<Application.Resources>
<ResourceDictionary>
<Color x:Key="Primary">#2196F3</Color>
</ResourceDictionary>
</Application.Resources>
Then using this resource by style in Shell.Resource
.
<Style Class="FlyoutItemLabelStyle" TargetType="Label">
<Setter Property="TextColor" Value="{DynamicResource Primary}" />
</Style>
You can change this resource color by code behind:
private void btn_Clicked(object sender, EventArgs e)
{
Application.Current.Resources["Primary"] = Color.Red;
}
Best Regards,
Cherry Bu
---
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.