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 works with Avalonia's ThemeDictionaries architecture:
RequestedThemeVariant triggers Avalonia's built-in resource refreshLight or Dark variant with its unique color paletteDaisyThemeLoader.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 .axaml file (e.g., MainWindow.axaml), add the namespace and control:
<!-- Add at top of file -->
xmlns:controls="clr-namespace:Flowery.Controls;assembly=Flowery.NET"
<!-- 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.axaml must include in Application.Styles. If you're not using another base theme (like Semi or Material), add as the minimum required for core Avalonia controls to render properly.
DaisyThemeController for quick toggle + full list selection.DaisyBase100Brush, etc.) are present for accurate previews.