FloweryComponentSidebar is a high-performance, navigational sidebar designed for the Gallery and complex app layouts. It features collapsible categories, clickable items with selection persistence, live search filtering, and deep integration with the project's global sizing and localization systems.
Key Features:FlowerySizeManager.DaisyExpander to bypass typical Uno/XAML performance issues on Skia/WASM.| Member | Description |
|---|---|
Categories (ObservableCollection) |
The source data. Add categories containing list of items. |
SelectedItem (SidebarItem?) |
Highlighted item. Selected state uses DaisyPrimaryBrush variant. |
SidebarWidth (double) |
The width of the sidebar. Default ~254. |
AutoSizeSidebarWidth (bool) |
If true, sidebar width scales automatically with the global DaisySize. |
SearchText (string) |
Live filtering query. Syncs automatically with the internal search input. |
Size (DaisySize) |
The manual sizing override. Typically synced with the global scale. |
ItemSelected (event) |
Fired when an item is clicked. Includes the item and its parent category. |
FavoriteToggled (event) |
Fired when an item's favorite/star icon is toggled. |
The sidebar uses a hierarchy of model classes that support localizable display names via FloweryLocalization:
SidebarCategory: Contains Name (key), IconKey, IsExpanded, and Items.SidebarItem: Basic clickable item. Includes Id, Name (key), TabHeader, Badge, and IsFavorite.SidebarLanguageSelectorItem: Renders a localized language dropdown.
- SidebarThemeSelectorItem: Renders a themed color/theme dropdown.
- SidebarSizeSelectorItem: Renders the DaisyUI global size selector.
SidebarCategory.DisplayName and SidebarItem.DisplayName automatically resolve via FloweryLocalization.GetString(Name). Setting Name="Actions" will display "Actions" in English or "Aktionen" in German if the translation exists.
<controls:FloweryComponentSidebar
x:Name="Sidebar"
AutoSizeSidebarWidth="True"
ItemSelected="OnSidebarItemSelected" />
var general = new SidebarCategory { Name = "General", IconKey = "DaisyIconHome" };
general.Items.Add(new SidebarItem { Id = "welcome", Name = "Welcome", TabHeader = "Home" });
general.Items.Add(new SidebarItem { Id = "settings", Name = "Settings", TabHeader = "Home", ShowFavoriteIcon = true });
// Add a special selector item
general.Items.Add(new SidebarSizeSelectorItem { Id = "size_picker", Name = "Global Size" });
Sidebar.Categories = new ObservableCollection<SidebarCategory> { general };
The sidebar uses a sophisticated internal metrics system (SidebarMetrics) to ensure a balanced look across all 5 standard sizes (ExtraSmall to ExtraLarge).
DaisySize*SectionHeaderFontSize).Selected items are visually distinct, using the project's Primary color palette:
{DynamicResource DaisyPrimaryBrush}{DynamicResource DaisyPrimaryContentBrush} (white/contrast text)The sidebar automatically persists its state via StateStorageProvider:
1. Selection: Re-selects the last item on app restart.
2. Expansion: Remembers which categories were collapsed or expanded.
3. Scroll Position: Attempts to scroll the selected item into view on load if it's deep in a long list.
SidebarCategory for the root and SidebarItem (or derivatives) for the children.SearchText property or verify IsExpanded on the parent.sidebar.SelectedItem = myItem.FloweryComponentSidebar manually manages its internal visual tree; avoid adding children directly via XAML Children property.