Skip to content

ThemeSwitcher class

Defined in

Namespace: CrissCross.Avalonia.UI.Controls Assembly: CrissCross.Avalonia.UI.dll Full name: CrissCross.Avalonia.UI.Controls.ThemeSwitcher Modifiers: public

Summary

        Represents a theme preference picker over the platform theme service.
        

Applies to

net10.0, net10.0-browserwasm1.0, net10.0-desktop1.0, net9.0, net9.0-browserwasm1.0, net9.0-desktop1.0, net8.0, net8.0-ios17.5, net8.0-maccatalyst17.5, net8.0-macos14.2, net8.0-macos14.5, net8.0-tvos17.2, netstandard2.1, net471

Class hierarchy
classDiagram
class ThemeSwitcher
class TemplatedControl
TemplatedControl <|-- ThemeSwitcher

Inherits from: TemplatedControl

Constructors

NameSummary
.ctorInitializes a new instance of the [ThemeSwitcher](# class.

Properties

NameSummary
SelectedChoiceGets or sets the selected theme preference.
SystemChoiceGets or sets the current concrete system theme.
SupportsHighContrastGets or sets a value indicating whether high contrast should be offered.
CurrentStateGets or sets the current resolved theme preference state.
ThemeServiceGets or sets the optional platform theme service used when applying a choice.
ThemeChangedCommandGets or sets a command invoked with the selected theme choice after a theme is applied.
ApplyThemeCommandGets the command that applies a selected theme choice.

Fields

NameSummary
static SelectedChoicePropertyProperty for [SelectedChoice](#
static SystemChoicePropertyProperty for [SystemChoice](#
static SupportsHighContrastPropertyProperty for [SupportsHighContrast](#
static CurrentStatePropertyProperty for [CurrentState](#
static ThemeServicePropertyProperty for [ThemeService](#
static ThemeChangedCommandPropertyProperty for [ThemeChangedCommand](#

Methods

NameSummary
CreateStateCreates a platform-neutral theme preference state from the current control inputs.
ApplyChoiceApplies a theme choice and emits the selected choice.
OnPropertyChangedCalled when a avalonia property changes on the object.
Inherited members