DaisyThemeDropdown is a ComboBox listing available themes from DaisyThemeManager. It previews theme colors in a 2×2 dot grid and applies the selected theme. It syncs selection with the current theme when themes change externally.
This control uses DaisyThemeManager internally, which manages the application's theme resources:
DaisyThemeLoader.ApplyThemeToApplication() instead| Property | Description |
|---|---|
SelectedTheme |
Name of the currently selected theme. Setting this applies the theme. |
| ItemsSource | Auto-populated from DaisyThemeManager.AvailableThemes with preview brushes. |
| Sync | Subscribes to ThemeChanged to update selection when themes change elsewhere. |
The dropdown automatically syncs to the current theme during construction:
DaisyThemeManager.CurrentThemeName is already set (e.g., app restored theme from settings), the dropdown syncs to that theme without re-applying it.ApplyTheme.This ensures apps can restore persisted theme preferences before constructing UI controls without worrying about dropdowns overriding the saved theme.
In your .xaml file (e.g., MainWindow.xaml), add the namespace and control:
<!-- Add at top of file -->
xmlns:controls="using:Flowery.Controls"
<!-- Default theme dropdown - shows all 35+ themes with color previews -->
<controls:DaisyThemeDropdown Width="220" />
<!-- Binding selected theme to ViewModel -->
<controls:DaisyThemeDropdown SelectedTheme="{Binding CurrentTheme, Mode=TwoWay}" />
Prerequisite: Your App.xaml must include Flowery.Uno's theme resources in Application.Resources.MergedDictionaries:
<ResourceDictionary Source="ms-appx:///Flowery.Uno/Themes/Generic.xaml" />
The dropdown automatically calculates dimensions based on the Size property:
MinWidth is computed to ensure all content fits:
DaisyResourceLookup.GetDefaultSwatchSize(Size) design tokenThis prevents the dropdown arrow from being clipped, especially at smaller sizes (ExtraSmall, Small).
The 5 color preview dots scale with the control size:
| Size | Swatch Diameter |
|---|---|
| ExtraSmall | 6px |
| Small | 8px |
| Medium | 10px |
| Large | 12px |
| ExtraLarge | 14px |
> Note: Setting Width below the computed MinWidth will be overridden. If you need a narrower dropdown, also set MinWidth explicitly (may cause visual clipping).
DaisyThemeController for quick toggle + full list selection.DaisyBase100Brush, etc.) are present for accurate previews.