In This Article

Native Control Themes

Control themes are included for all native Avalonia controls that share the same design aesthetic as Actipro's own controls, allowing all controls to seamlessly mix within an application. The native control themes are enabled by default, and many support a variety of design options, along with semantic color variants.

Native Controls

Nearly all native Avalonia controls have control themes in the ActiproSoftware.Controls.Avalonia NuGet package. The only exceptions are the native ColorPicker and DataGrid controls since they are shipped by the Avalonia team in separate optional NuGet packages of their own.

Configuring

As described in the Getting Started topic, when adding a ModernTheme instance to the Application.Styles collection, native control themes will be enabled by default. They can be disabled by setting the AreNativeControlThemesEnabled property to false.

This example of adding ModernTheme to the Application.Styles collection automatically enables native control themes.

<Application ... xmlns:actipro="http://schemas.actiprosoftware.com/avaloniaui">
	<Application.Styles>

		<actipro:ModernTheme />

	</Application.Styles>
</Application>

Several theme definition options allow for selection of which control theme to use by default. The following example shows how to tell the theme to render tabs using a Subtle appearance instead of Outline.

<Application ...
	xmlns:actipro="http://schemas.actiprosoftware.com/avaloniaui"
	xmlns:generation="using:ActiproSoftware.UI.Avalonia.Themes.Generation">
	<Application.Styles>

		<actipro:ModernTheme>
			<actipro:ModernTheme.Definition>
				<generator:ThemeDefinition TabAppearanceKind="Subtle" />
			</actipro:ModernTheme.Definition>
		</actipro:ModernTheme>

	</Application.Styles>
</Application>

Color Variants

Screenshot

Most native controls support multiple semantic color variants. Use one of the following style class names to alter the semantic color variant of supported controls:

  • accent - Uses the theme's accent color ramp, which defaults to blue.
  • success - Uses the theme's success color ramp, which defaults to green.
  • warning - Uses the theme's warning color ramp, which defaults to orange.
  • danger - Uses the theme's danger color ramp, which defaults to red.

Control Theme Kinds

The ControlThemeKind enumeration has a value for all controls supported by Actipro's themes, including many native control themes.

Tip

See the Theme Assets topic for information on how to reference and use specific control themes, which is important when a control should have a non-default theme (e.g., a Solid button instead of an Outline button in a certain scenario), or when making a custom control theme that should be based on one of the Actipro control themes.

The lists below show the various control theme kind options for each type, and in parentheses indicate any style class names that can be specified to trigger the control theme.

This example shows how to render a solid accented button:

<Button Classes="theme-solid accent" Content="Accented Solid Button" />

Button Controls

All button control themes support the accent, success, warning, and danger style class names for semantic color variants.

Screenshot

Button, DropDownButton, and SplitButton controls in the outline, solid, and soft themes showing semantic color variants

Button Type

Screenshot

Button controls in the outline, solid, soft, subtle, and link control themes with neutral colors

  • ButtonBase - Base control theme used by several others.
  • ButtonInvisible (theme-invisible) - Completely transparent but can be clicked.
  • ButtonLink (theme-link) - Has a link-like appearance.
  • ButtonOutline (theme-outline) - Has an outline appearance.
  • ButtonSoft (theme-soft) - Has a soft fill appearance.
  • ButtonSolid (theme-solid) - Has a solid appearance.
  • ButtonSubtle (theme-subtle) - Has a subtle fill appearance, only on pointer over.

Screenshot

DropDownButton controls in the outline, solid, soft, subtle, and link control themes with neutral colors

RepeatButton Type

RepeatButton uses the same control themes as Button. See the "Button Type" section for details.

SplitButton Type

Screenshot

SplitButton controls in the outline, solid, soft, subtle, and link control themes with neutral colors

ToggleButton Type

Screenshot

ToggleButton controls in the outline, solid, soft, subtle, and link control themes with neutral colors with unchecked (top) and checked (bottom) states

Calendar Controls

Screenshot

Calendar control in the default theme

The following default control themes are defined for their respective control types:

Edit Controls

All primary edit control themes support the accent, success, warning, and danger style class names for color variants.

Screenshot

TextBox, ComboBox, ButtonSpinner, and CalendarDatePicker controls in the outline and soft themes showing semantic color variants

AutoCompleteBox Type

Screenshot

AutoCompleteBox controls in the outline and soft control themes with neutral colors

These style class names trigger special behaviors:

  • has-clear-button or clearButton - Renders a Clear button in the control when it is non-empty and has focus.

ButtonSpinner Type

Screenshot

ButtonSpinner controls in the outline and soft control themes with neutral colors

Screenshot

ButtonSpinner controls with vertical and horizontal button orientations

Set the ThemeProperties.SpinnerHasHorizontalOrientation attached property on a ButtonSpinner to true to arrange spinner buttons horizontally instead of vertically. Horizontal arrangement is better for touch-friendly user interfaces since each button gets twice the amount of surface area. Theme Definitions also provide a global default value for this attached property that can be altered.

The following additional control theme is available for the Button used by the default control theme:

CalendarDatePicker Type

Screenshot

CalendarDatePicker controls in the outline and soft control themes with neutral colors

The following additional control theme is available for the embedded Button:

ComboBox Type

Screenshot

ComboBox controls in the outline and soft control themes with neutral colors

ComboBoxItem Type

DatePicker Type

Screenshot

DatePicker controls in the outline and soft control themes with neutral colors

DatePickerPresenter Type

The following additional control theme is used by the default control theme:

NumericUpDown Type

Screenshot

NumericUpDown controls in the outline and soft control themes with neutral colors

Screenshot

NumericUpDown controls with vertical and horizontal button orientations

Set the ThemeProperties.SpinnerHasHorizontalOrientation attached property on a NumericUpDown to true to arrange spinner buttons horizontally instead of vertically. Horizontal arrangement is better for touch-friendly user interfaces since each button gets twice the amount of surface area. Theme Definitions also provide a global default value for this attached property that can be altered.

TextBox Type

Screenshot

TextBox controls in the outline and soft control themes with neutral colors

These style class names trigger special behaviors:

  • has-clear-button or clearButton - Renders a Clear button in the control when it is non-empty and has focus.
  • has-reveal-password-button or revealPasswordButton - Renders a Reveal Password button in the control when it is non-empty and is configured for passwords.

The following additional control themes are used by the TextBox control themes:

TimePicker Type

TimePickerPresenter Type

Screenshot

TimePicker controls in the outline and soft control themes with neutral colors

The following additional control theme is used by the default control theme:

List Controls

ItemsControl Type

ListBox Type

Screenshot

ListBox control in the default theme

ListBoxItem Type

TreeView Type

Screenshot

TreeView control in the default theme

TreeViewItem Type

The following additional control theme is used by the default control theme:

Screenshot

Menu control in the default theme with sub menus open

ContextMenu Type

  • Menu - Default control theme.

NativeMenuBar Type

Separator Type

Other Menu Control Themes

The following additional control themes are used by the menu control themes:

Scroll Controls

Scrollbars can optionally toggle the visibility of line buttons. See the Scrolling topic for more details.

ScrollBar Type

Screenshot

ScrollBar controls in the default and line buttons control themes

The following additional control themes are used by the default control theme:

  • ScrollBarLineButton - The control theme for the RepeatButton instances on the scrollbar that increase/decrease the scroll position by small values.
  • ScrollBarPageButton - The control theme for the invisible RepeatButton instances on the scrollbar track that increase/decrease the scroll position by large values.
  • ScrollBarThumb - The control theme for the Thumb control when not using line buttons.
  • ScrollBarThumbBetweenButtons - The control theme for the Thumb control when using line buttons.

ScrollViewer Type

Screenshot

ScrollViewer controls in the default and overlay control themes

Switch Controls

All switch control themes support the accent, success, warning, and danger style class names for semantic color variants.

Screenshot

CheckBox, RadioButton, ToggleSwitch, and Slider controls in the outline and solid themes showing semantic color variants

The CheckBox, RadioButton, and ToggleSwitch control type themes automatically adjust their size to match the control's font size. For example, a CheckBox at a 24pt font size will render a larger check UI element than one with a 12pt font size. The relative size of those controls can be explicitly set using one of following style class names:

  • size-xs - Sizes the control consistent with an extra-small font size.
  • size-sm - Sizes the control consistent with a small font size.
  • size-md - Sizes the control consistent with a normal font size.
  • size-lg - Sizes the control consistent with a large font size.
  • size-xl - Sizes the control consistent with an extra-large font size.

CheckBox Type

Screenshot

CheckBox controls in the outline and solid control themes with neutral colors in checked and unchecked states

RadioButton Type

Screenshot

RadioButton controls in the outline and solid control themes with neutral colors in checked and unchecked states

Slider Type

Screenshot

Slider controls in the outline and solid control themes with neutral colors

The following additional control themes are used by the Slider control themes:

  • SliderThumb - The control theme for the Thumb control.
  • SliderTrackButton - The control theme for the RepeatButton instances on the track that change the value.

ToggleSwitch Type

Screenshot

ToggleSwitch controls in the outline and solid control themes with neutral colors in on and off states

Set the ThemeProperties.ToggleSwitchHasFarAffinityProperty attached property on a ToggleSwitch to true to arrange the knob/track on the right side of the control instead of the left side (assuming left-to-right culture). See the Theme Definitions topic for details on how to change the global default.

Tab Controls

Screenshot

TabControl controls in the outline and subtle control themes (TabStrip has the same appearance)

Tab controls do not support semantic color variants.

TabControl Type

TabItem Type

  • TabItemOutline (theme-outline) - Has an outline appearance.
  • TabItemSubtle (theme-subtle) - Has a subtle appearance with accent underline for selection.

TabStrip Type

  • TabStripBase - Base control theme used by several others.
  • TabStripOutline (theme-outline) - Has an outline appearance.
  • TabStripSubtle (theme-subtle) - Has a subtle appearance with accent underline for selection.

TabStripItem Type

Typography Controls

All typography control themes support the accent, success, warning, and danger style class names for semantic color variants.

Screenshot

TextBlock controls in the default, heading, body, and code themes showing semantic color variants

Each typography control type defines "body", "code", and "heading" control themes. The relative font size of these control themes can be explicitly set using one of following style class names:

  • size-xs - An extra-small font size.
  • size-sm - A small font size.
  • size-md - A normal font size.
  • size-lg - A large font size.
  • size-xl - An extra-large font size.

Label Type

  • LabelBase - Base control theme used by several others.
  • Label - Default control theme.
  • LabelBody (theme-text-body) - Uses a font family and size for body text.
  • LabelCode (theme-text-code) - Uses a font family and size for code text.
  • LabelHeading (theme-text-heading) - Uses a font family and size for heading text.
  • LabelFormControlLabel (theme-form-control-label) - Formatted as the label for a form control.
  • LabelFormControlMessage (theme-form-control-message) - Formatted as the message for a form control (typically shown below the control).

SelectableTextBlock Type

TextBlock Type

Other Controls

CaptionButtons Type

Screenshot

CaptionButtons control in the default theme

The following additional control themes are used by the default control themes:

DataValidationErrors Type

Expander Type

Screenshot

Expander control in the default theme expanded down

The following additional control themes are available for the ToggleButton used by the default control theme:

NotificationCard Type

  • NotificationCard - Default control theme with color variants based on the notification type.

ProgressBar Type

The default control theme supports the accent, success, warning, and danger style class names for semantic color variants.

Screenshot

ProgressBar controls in the default theme with neutral and semantic color variants

Additional Types with Default Themes

The following default control themes are defined for their respective control types:

ColorPicker Control

The native ColorPicker control is shipped in its own NuGet package by the Avalonia team and is optional. When used in your application, a couple extra steps are required to support Actipro themes for the control.

Configuring

First, a reference to the ActiproSoftware.Controls.Avalonia.Themes.ColorPicker NuGet package must be added to your project.

Then as described in the Getting Started topic, the ModernTheme.Includes property must specify either the NativeColorPicker or All option, as in the following example.

<Application ... xmlns:actipro="http://schemas.actiprosoftware.com/avaloniaui">
	<Application.Styles>

		<actipro:ModernTheme Includes="NativeColorPicker, NativeDataGrid" />

	</Application.Styles>
</Application>

ColorPicker Type

The ColorPicker control theme supports the accent, success, warning, and danger style class names for semantic color variants.

Screenshot

ColorPicker controls in the default theme and optional value display with outline, solid, and soft class styles and semantic color variants

Screenshot

ColorPicker controls in the default theme (top) and optional value display (bottom) with outline, solid, soft, subtle, and link class styles and neutral colors

  • ColorPicker - Default control theme. Use theme-outline, theme-solid, theme-soft, theme-subtle, and theme-link style class names for a different appearance. Use has-value-text style class name to display the current hex value.

ColorView Type

Screenshot

Other Types

The following default control themes are defined for their respective control types and embedded within the ColorView default control theme:

DataGrid Control

Screenshot

DataGrid control in the default theme

The native DataGrid control is shipped in its own NuGet package by the Avalonia team and is optional. When used in your application, a couple extra steps are required to support Actipro themes for the control.

Configuring

First, a reference to the ActiproSoftware.Controls.Avalonia.Themes.DataGrid NuGet package must be added to your project.

Then as described in the Getting Started topic, the ModernTheme.Includes property must specify either the NativeDataGrid or All option, as in the following example.

<Application ... xmlns:actipro="http://schemas.actiprosoftware.com/avaloniaui">
	<Application.Styles>

		<actipro:ModernTheme Includes="NativeColorPicker, NativeDataGrid" />

	</Application.Styles>
</Application>

The following default control themes are defined for their respective control types: