Issue
Here's the code that I have:
grid.Children.Add(new Label
{
Text = "00",
VerticalOptions = LayoutOptions.Center,
HorizontalOptions = LayoutOptions.Center,
TextColor = " {DynamicResource PageBackgroundColor}"
});
But it does not accept that format for the setting of Dynamic resource.
Solution
That is happening because you are using the wrong syntax to do it, try something like this:
TextColor = (Color) App.Current.Resources["PageBackgroundColor"];
If your dynamic resource keeps changing at runtime do something like below:
yourLabel.SetDynamicResource (VisualElement.TextColorProperty, "PageBackgroundColor");
In case there is a query, please revert
Answered By - FreakyAli
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.