Skip to main content
Version: 11.0.0

Pseudo Classes

Pseudo classes are generated by a control, usually as a response to some sort of state.

For example :pointerover pseudo class indicates that the pointer input is currently over (inside the bounds of) a control.

Pseudo classes are not set in the Classes attributes of a control (unlike style classes).

Common pseudo classes include:

:focus, :disabled, :pressed for buttons, and :checked for checkboxes.

A control can have more than one pseudo class active at a time.

You can target one or more pseudo classes in a style selector. For example:

<Style Selector="Button.red:focus:pointover">

This selector targets button controls with the red class set, and that are in the :focus and the :pointover pseudo class state.

Some common pseudo classes:

Pseudo ClassDescription
:pointeroverThe pointer input is currently over (inside the bounds of) a control
:focusA control has the input focus.
:disabledA control is unable to respond to user interaction.
:pressedA button control is in the down position.
:checkedA checkbox control is selected (check mark is showing).

Custom Pseudo Classes​

You can create your own pseudo classes for custom controls based on CustomControl or TemplatedControl. The function below adds or remove a pseudo class depending on a Boolean value on a StyledElement.

PseudoClasses.Set(":className", bool);