Hello,
The following code would successfully swap the dynamic resource and static resource value on my side.
private void OnCounterClicked(object sender, EventArgs e)
{
//Swap the background color of the two controls
scroll.BackgroundColor = (Color)App.Current.Resources["NavigationBarTextColor"];
test_label.SetDynamicResource(Label.TextColorProperty, "NormalTextColor");
}
In addition, you could refer to Dynamic styles to get the best practice of using dynamic styles in MAUI.
Best Regards,
Alec Liu.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
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.