Table of Contents

Class Selectors

Namespace
Avalonia.Styling
Assembly
Avalonia.Base.dll

Extension methods for Selector.

public static class Selectors
Inheritance
Selectors
Inherited Members

Methods

Child(Selector)

Returns a selector which matches a previous selector's child.

public static Selector Child(this Selector previous)

Parameters

previous Selector

The previous selector.

Returns

Selector

The selector.

Class(Selector?, string)

Returns a selector which matches a control's style class.

public static Selector Class(this Selector? previous, string name)

Parameters

previous Selector

The previous selector.

name string

The name of the style class.

Returns

Selector

The selector.

Descendant(Selector?)

Returns a selector which matches a descendant of a previous selector.

public static Selector Descendant(this Selector? previous)

Parameters

previous Selector

The previous selector.

Returns

Selector

The selector.

Is(Selector?, Type)

Returns a selector which matches a type or a derived type.

public static Selector Is(this Selector? previous, Type type)

Parameters

previous Selector

The previous selector.

type Type

The type.

Returns

Selector

The selector.

Is<T>(Selector?)

Returns a selector which matches a type or a derived type.

public static Selector Is<T>(this Selector? previous) where T : StyledElement

Parameters

previous Selector

The previous selector.

Returns

Selector

The selector.

Type Parameters

T

The type.

Name(Selector?, string)

Returns a selector which matches a control's Name.

public static Selector Name(this Selector? previous, string name)

Parameters

previous Selector

The previous selector.

name string

The name.

Returns

Selector

The selector.

Nesting(Selector?)

public static Selector Nesting(this Selector? previous)

Parameters

previous Selector

Returns

Selector

Not(Selector?, Selector)

Returns a selector which inverts the results of selector argument.

public static Selector Not(this Selector? previous, Selector argument)

Parameters

previous Selector

The previous selector.

argument Selector

The selector to be not-ed.

Returns

Selector

The selector.

Not(Selector?, Func<Selector?, Selector>)

Returns a selector which inverts the results of selector argument.

public static Selector Not(this Selector? previous, Func<Selector?, Selector> argument)

Parameters

previous Selector

The previous selector.

argument Func<Selector, Selector>

The selector to be not-ed.

Returns

Selector

The selector.

NthChild(Selector?, int, int)

The :nth-child() pseudo-class matches elements based on their position in a group of siblings.

public static Selector NthChild(this Selector? previous, int step, int offset)

Parameters

previous Selector

Previous selector.

step int

Position step.

offset int

Initial index offset.

Returns

Selector

The selector.

Remarks

Element indices are 1-based.

NthLastChild(Selector?, int, int)

The :nth-child() pseudo-class matches elements based on their position among a group of siblings, counting from the end.

public static Selector NthLastChild(this Selector? previous, int step, int offset)

Parameters

previous Selector

Previous selector.

step int

Position step.

offset int

Initial index offset, counting from the end.

Returns

Selector

The selector.

Remarks

Element indices are 1-based.

OfType(Selector?, Type)

Returns a selector which matches a type.

public static Selector OfType(this Selector? previous, Type type)

Parameters

previous Selector

The previous selector.

type Type

The type.

Returns

Selector

The selector.

OfType<T>(Selector?)

Returns a selector which matches a type.

public static Selector OfType<T>(this Selector? previous) where T : StyledElement

Parameters

previous Selector

The previous selector.

Returns

Selector

The selector.

Type Parameters

T

The type.

Or(params Selector[])

Returns a selector which ORs selectors.

public static Selector Or(params Selector[] selectors)

Parameters

selectors Selector[]

The selectors to be OR'd.

Returns

Selector

The selector.

Or(IReadOnlyList<Selector>)

Returns a selector which ORs selectors.

public static Selector Or(IReadOnlyList<Selector> selectors)

Parameters

selectors IReadOnlyList<Selector>

The selectors to be OR'd.

Returns

Selector

The selector.

PropertyEquals(Selector?, AvaloniaProperty, object?)

Returns a selector which matches a control with the specified property value.

public static Selector PropertyEquals(this Selector? previous, AvaloniaProperty property, object? value)

Parameters

previous Selector

The previous selector.

property AvaloniaProperty

The property.

value object

The property value.

Returns

Selector

The selector.

PropertyEquals<T>(Selector?, AvaloniaProperty<T>, object?)

Returns a selector which matches a control with the specified property value.

public static Selector PropertyEquals<T>(this Selector? previous, AvaloniaProperty<T> property, object? value)

Parameters

previous Selector

The previous selector.

property AvaloniaProperty<T>

The property.

value object

The property value.

Returns

Selector

The selector.

Type Parameters

T

The property type.

Template(Selector)

Returns a selector which enters a lookless control's template.

public static Selector Template(this Selector previous)

Parameters

previous Selector

The previous selector.

Returns

Selector

The selector.