Table of Contents

Class ThemeBindings

Namespace
DrawnUi.Draw
Assembly
DrawnUi.Maui.dll

Helper methods for using theme bindings in code-behind

public static class ThemeBindings
Inheritance
ThemeBindings
Inherited Members

Methods

GetThemeValue<T>(T, T, T)

Gets the current theme value without creating a binding

public static T GetThemeValue<T>(T lightValue, T darkValue, T defaultValue = default)

Parameters

lightValue T
darkValue T
defaultValue T

Returns

T

Type Parameters

T

SetThemeBinding(BindableObject, BindableProperty, object, object, object)

Sets up a theme binding in code-behind

public static ThemeBinding SetThemeBinding(BindableObject target, BindableProperty property, object lightValue, object darkValue, object defaultValue = null)

Parameters

target BindableObject
property BindableProperty
lightValue object
darkValue object
defaultValue object

Returns

ThemeBinding

WithThemeBinding<TControl>(TControl, BindableProperty, object, object, object)

Fluent extension method for setting theme bindings

public static TControl WithThemeBinding<TControl>(this TControl control, BindableProperty property, object lightValue, object darkValue, object defaultValue = null) where TControl : BindableObject

Parameters

control TControl
property BindableProperty
lightValue object
darkValue object
defaultValue object

Returns

TControl

Type Parameters

TControl