DynamicResourceHandler extensions
The DynamicResourceHandler
extensions provide a series of extension methods that support configuring IDynamicResourceHandler
which can be used to Theme an App.
The extensions offer the following methods:
DynamicResource
The DynamicResource
method sets the DynamicResource
property on a control implementing IDynamicResourceHandler
.
The following example binds Label.TextColorProperty
to the ResourceDictionary key TextColor
:
new Label().DynamicResource(Label.TextColorProperty, "TextColor");
DynamicResources
The DynamicResources
method sets multiple DynamicResource
properties on a control implementing IDynamicResourceHandler
.
The following example binds Label.TextColorProperty
to the ResourceDictionary key TextColor
, and also binds Label.FontFamilyProperty
to the ResourceDictionary key FontFamily
,
new Label().DynamicResources(Label.TextColorProperty, "TextColor",
Label.FontFamilyProperty, "FontFamily");
.NET MAUI Community Toolkit