DaisyThemeController

Overview

DaisyThemeController

DaisyThemeController is a toggle-based switch for applying Daisy themes via DaisyThemeManager. It supports multiple display modes (toggle, checkbox, swap, text/icon variants) and syncs IsChecked with the current theme. Switching updates CheckedTheme/UncheckedTheme and can auto-adopt new themes.

How Theming Works

This control uses DaisyThemeManager internally, which manages the application's theme resources:

Properties

Property Description
Mode Visual mode: Toggle, Checkbox, Swap, ToggleWithText, ToggleWithIcons.
UncheckedLabel / CheckedLabel Labels for light/dark (or custom) modes.
UncheckedTheme / CheckedTheme Theme names to apply on off/on states (defaults: Light/Dark).

Behavior

Quick Examples

In your .xaml file (e.g., MainWindow.xaml), add the namespace and control:

<!-- Add at top of file -->
xmlns:controls="using:Flowery.Controls"

<!-- Simple toggle - just drop it in, defaults to Light/Dark -->
<controls:DaisyThemeController Mode="Toggle" />

<!-- Animated sun/moon swap (as used in Gallery) -->
<controls:DaisyThemeController Mode="Swap" />

<!-- Custom theme pairing -->
<controls:DaisyThemeController Mode="ToggleWithText"
    UncheckedTheme="Light" CheckedTheme="Synthwave"
    UncheckedLabel="Light" CheckedLabel="Synthwave" />
Prerequisite: Your App.xaml must include Flowery.Uno's theme resources in Application.Resources.MergedDictionaries:
<ResourceDictionary Source="ms-appx:///Flowery.Uno/Themes/Generic.xaml" />

Tips & Best Practices

Related Controls