How to set ContentPage background to DynamicResource

KaponeKapone USMember ✭✭
edited June 2018 in Xamarin.Forms

My understanding is that in order to set an elements property in code behind, to a dynamic resource that will need to change at a later time, is to use the following syntax.

this.SetResourceReference(BackgroundColorProperty, "BackgroundColor");

However it tells me ContentPage does not contain a definition for SetResourceReference. The Xaml would be as follows:

<ContentPage BackgroundColor="{DynamicResource BackgroundColor}" />

I need to do this in my BasePage that all my pages inherit from. It is just a class that inherits from ContentPage. So how can I accomplish this in code behind?

Best Answer

Answers

Sign In or Register to comment.