Перейти к основному содержимому

Class VisualElementExtensions

Namespace: Aspid.FastTools.UIElements
Assembly: Aspid.FastTools.dll

Provides extension methods for VisualElement.

public static class VisualElementExtensions

Inheritance​

object ← VisualElementExtensions

Methods​

AddBoldUnityFontStyleAndWeight<T>(T)​

Adds bold to unityFontStyleAndWeight, preserving any existing italic style.

public static T AddBoldUnityFontStyleAndWeight<T>(this T element) where T : VisualElement

Parameters​

element T

The element to modify.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

Remarks​

Transitions: Normal → Bold, Italic → BoldAndItalic. Other values are left unchanged.

AddChild<T>(T, VisualElement)​

Adds an element to the contentContainer of this element.

public static T AddChild<T>(this T element, VisualElement child) where T : VisualElement

Parameters​

element T

The element to modify.

child VisualElement

The child element to add.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

AddChildIf<T>(T, bool, VisualElement)​

Conditionally adds an element to the contentContainer of this element.

public static T AddChildIf<T>(this T element, bool condition, VisualElement child) where T : VisualElement

Parameters​

element T

The element to modify.

condition bool

When true, the operation is performed; otherwise, the element is returned unchanged.

child VisualElement

The child element to add.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

AddChildren<T>(T, Span<VisualElement>)​

Adds a span of child elements to the contentContainer of this element.

public static T AddChildren<T>(this T element, Span<VisualElement> children) where T : VisualElement

Parameters​

element T

The element to modify.

children Span<VisualElement>

The children to add.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

AddChildren<T>(T, List<VisualElement>)​

Adds a list of child elements to the contentContainer of this element.

public static T AddChildren<T>(this T element, List<VisualElement> children) where T : VisualElement

Parameters​

element T

The element to modify.

children List<VisualElement>

The children to add.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

AddChildren<T>(T, params VisualElement[])​

Adds an array of child elements to the contentContainer of this element.

public static T AddChildren<T>(this T element, params VisualElement[] children) where T : VisualElement

Parameters​

element T

The element to modify.

children VisualElement[]

The children to add.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

AddChildren<T>(T, IEnumerable<VisualElement>)​

Adds an enumerable of child elements to the contentContainer of this element.

public static T AddChildren<T>(this T element, IEnumerable<VisualElement> children) where T : VisualElement

Parameters​

element T

The element to modify.

children IEnumerable<VisualElement>

The children to add.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

AddChildren<T>(T, ReadOnlySpan<VisualElement>)​

Adds a read-only span of child elements to the contentContainer of this element.

public static T AddChildren<T>(this T element, ReadOnlySpan<VisualElement> children) where T : VisualElement

Parameters​

element T

The element to modify.

children ReadOnlySpan<VisualElement>

The children to add.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

AddChildrenIf<T>(T, bool, Span<VisualElement>)​

Conditionally adds a span of child elements to the contentContainer of this element.

public static T AddChildrenIf<T>(this T element, bool condition, Span<VisualElement> children) where T : VisualElement

Parameters​

element T

The element to modify.

condition bool

When true, the operation is performed; otherwise, the element is returned unchanged.

children Span<VisualElement>

The children to add.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

AddChildrenIf<T>(T, bool, List<VisualElement>)​

Conditionally adds a list of child elements to the contentContainer of this element.

public static T AddChildrenIf<T>(this T element, bool condition, List<VisualElement> children) where T : VisualElement

Parameters​

element T

The element to modify.

condition bool

When true, the operation is performed; otherwise, the element is returned unchanged.

children List<VisualElement>

The children to add.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

AddChildrenIf<T>(T, bool, params VisualElement[])​

Conditionally adds an array of child elements to the contentContainer of this element.

public static T AddChildrenIf<T>(this T element, bool condition, params VisualElement[] children) where T : VisualElement

Parameters​

element T

The element to modify.

condition bool

When true, the operation is performed; otherwise, the element is returned unchanged.

children VisualElement[]

The children to add.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

AddChildrenIf<T>(T, bool, IEnumerable<VisualElement>)​

Conditionally adds an enumerable of child elements to the contentContainer of this element.

public static T AddChildrenIf<T>(this T element, bool condition, IEnumerable<VisualElement> children) where T : VisualElement

Parameters​

element T

The element to modify.

condition bool

When true, the operation is performed; otherwise, the element is returned unchanged.

children IEnumerable<VisualElement>

The children to add.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

AddChildrenIf<T>(T, bool, ReadOnlySpan<VisualElement>)​

Conditionally adds a read-only span of child elements to the contentContainer of this element.

public static T AddChildrenIf<T>(this T element, bool condition, ReadOnlySpan<VisualElement> children) where T : VisualElement

Parameters​

element T

The element to modify.

condition bool

When true, the operation is performed; otherwise, the element is returned unchanged.

children ReadOnlySpan<VisualElement>

The children to add.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

AddClass<T>(T, string)​

Adds a USS class to the element.

public static T AddClass<T>(this T element, string value) where T : VisualElement

Parameters​

element T

The element to modify.

value string

The USS class name to add.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

AddItalicUnityFontStyleAndWeight<T>(T)​

Adds italic to unityFontStyleAndWeight, preserving any existing bold style.

public static T AddItalicUnityFontStyleAndWeight<T>(this T element) where T : VisualElement

Parameters​

element T

The element to modify.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

Remarks​

Transitions: Normal → Italic, Bold → BoldAndItalic. Other values are left unchanged.

AddStyleSheet<T>(T, StyleSheet)​

Adds a style sheet to styleSheets.

public static T AddStyleSheet<T>(this T element, StyleSheet value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleSheet

The style sheet to add.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

AddStyleSheetFromResources<T>(T, string)​

Loads a StyleSheet from Resources and adds it to styleSheets.

public static T AddStyleSheetFromResources<T>(this T element, string path) where T : VisualElement

Parameters​

element T

The element to modify.

path string

The Resources-relative path to the style sheet asset.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

Remarks​

Logs a warning and leaves the element unchanged when no asset is found at path.

ClearChildren<T>(T)​

Removes all children from the element.

public static T ClearChildren<T>(this T element) where T : VisualElement

Parameters​

element T

The element to modify.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

ClearChildrenIf<T>(T, bool)​

Conditionally removes all children from the element.

public static T ClearChildrenIf<T>(this T element, bool condition) where T : VisualElement

Parameters​

element T

The element to modify.

condition bool

When true, the operation is performed; otherwise, the element is returned unchanged.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

ClearClasses<T>(T)​

Removes all USS classes from the element.

public static T ClearClasses<T>(this T element) where T : VisualElement

Parameters​

element T

The element to modify.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

EnableClass<T>(T, string, bool)​

Adds or removes the USS class depending on enable.

public static T EnableClass<T>(this T element, string className, bool enable) where T : VisualElement

Parameters​

element T

The element to modify.

className string

The USS class name to enable or disable.

enable bool

When true, the class is added; otherwise, it is removed.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

InsertChild<T>(T, int, VisualElement)​

Inserts a child element at the specified index in the contentContainer of this element.

public static T InsertChild<T>(this T element, int index, VisualElement child) where T : VisualElement

Parameters​

element T

The element to modify.

index int

The index at which to insert the child.

child VisualElement

The child element to insert.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

InsertChildIf<T>(T, bool, int, VisualElement)​

Conditionally inserts a child element at the specified index in the contentContainer of this element.

public static T InsertChildIf<T>(this T element, bool condition, int index, VisualElement child) where T : VisualElement

Parameters​

element T

The element to modify.

condition bool

When true, the operation is performed; otherwise, the element is returned unchanged.

index int

The index at which to insert the child.

child VisualElement

The child element to insert.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

InsertChildren<T>(T, int, Span<VisualElement>)​

Inserts a span of child elements starting at the specified index in the contentContainer of this element.

public static T InsertChildren<T>(this T element, int index, Span<VisualElement> children) where T : VisualElement

Parameters​

element T

The element to modify.

index int

The index at which to start inserting children.

children Span<VisualElement>

The children to insert.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

InsertChildren<T>(T, int, List<VisualElement>)​

Inserts a list of child elements starting at the specified index in the contentContainer of this element.

public static T InsertChildren<T>(this T element, int index, List<VisualElement> children) where T : VisualElement

Parameters​

element T

The element to modify.

index int

The index at which to start inserting children.

children List<VisualElement>

The children to insert.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

InsertChildren<T>(T, int, params VisualElement[])​

Inserts an array of child elements starting at the specified index in the contentContainer of this element.

public static T InsertChildren<T>(this T element, int index, params VisualElement[] children) where T : VisualElement

Parameters​

element T

The element to modify.

index int

The index at which to start inserting children.

children VisualElement[]

The children to insert.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

InsertChildren<T>(T, int, IEnumerable<VisualElement>)​

Inserts an enumerable of child elements starting at the specified index in the contentContainer of this element.

public static T InsertChildren<T>(this T element, int index, IEnumerable<VisualElement> children) where T : VisualElement

Parameters​

element T

The element to modify.

index int

The index at which to start inserting children.

children IEnumerable<VisualElement>

The children to insert.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

InsertChildren<T>(T, int, ReadOnlySpan<VisualElement>)​

Inserts a read-only span of child elements starting at the specified index in the contentContainer of this element.

public static T InsertChildren<T>(this T element, int index, ReadOnlySpan<VisualElement> children) where T : VisualElement

Parameters​

element T

The element to modify.

index int

The index at which to start inserting children.

children ReadOnlySpan<VisualElement>

The children to insert.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

InsertChildrenIf<T>(T, bool, int, Span<VisualElement>)​

Conditionally inserts a span of child elements starting at the specified index in the contentContainer of this element.

public static T InsertChildrenIf<T>(this T element, bool condition, int index, Span<VisualElement> children) where T : VisualElement

Parameters​

element T

The element to modify.

condition bool

When true, the operation is performed; otherwise, the element is returned unchanged.

index int

The index at which to start inserting children.

children Span<VisualElement>

The children to insert.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

InsertChildrenIf<T>(T, bool, int, List<VisualElement>)​

Conditionally inserts a list of child elements starting at the specified index in the contentContainer of this element.

public static T InsertChildrenIf<T>(this T element, bool condition, int index, List<VisualElement> children) where T : VisualElement

Parameters​

element T

The element to modify.

condition bool

When true, the operation is performed; otherwise, the element is returned unchanged.

index int

The index at which to start inserting children.

children List<VisualElement>

The children to insert.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

InsertChildrenIf<T>(T, bool, int, params VisualElement[])​

Conditionally inserts an array of child elements starting at the specified index in the contentContainer of this element.

public static T InsertChildrenIf<T>(this T element, bool condition, int index, params VisualElement[] children) where T : VisualElement

Parameters​

element T

The element to modify.

condition bool

When true, the operation is performed; otherwise, the element is returned unchanged.

index int

The index at which to start inserting children.

children VisualElement[]

The children to insert.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

InsertChildrenIf<T>(T, bool, int, IEnumerable<VisualElement>)​

Conditionally inserts an enumerable of child elements starting at the specified index in the contentContainer of this element.

public static T InsertChildrenIf<T>(this T element, bool condition, int index, IEnumerable<VisualElement> children) where T : VisualElement

Parameters​

element T

The element to modify.

condition bool

When true, the operation is performed; otherwise, the element is returned unchanged.

index int

The index at which to start inserting children.

children IEnumerable<VisualElement>

The children to insert.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

InsertChildrenIf<T>(T, bool, int, ReadOnlySpan<VisualElement>)​

Conditionally inserts a read-only span of child elements starting at the specified index in the contentContainer of this element.

public static T InsertChildrenIf<T>(this T element, bool condition, int index, ReadOnlySpan<VisualElement> children) where T : VisualElement

Parameters​

element T

The element to modify.

condition bool

When true, the operation is performed; otherwise, the element is returned unchanged.

index int

The index at which to start inserting children.

children ReadOnlySpan<VisualElement>

The children to insert.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

RemoveBoldUnityFontStyleAndWeight<T>(T)​

Removes bold from unityFontStyleAndWeight, preserving any existing italic style.

public static T RemoveBoldUnityFontStyleAndWeight<T>(this T element) where T : VisualElement

Parameters​

element T

The element to modify.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

Remarks​

Transitions: Bold → Normal, BoldAndItalic → Italic. Other values are left unchanged.

RemoveChild<T>(T, VisualElement)​

Removes the specified child from the element.

public static T RemoveChild<T>(this T element, VisualElement child) where T : VisualElement

Parameters​

element T

The element to modify.

child VisualElement

The child element to remove.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

RemoveChildAt<T>(T, int)​

Removes the child at the specified index from the element.

public static T RemoveChildAt<T>(this T element, int index) where T : VisualElement

Parameters​

element T

The element to modify.

index int

The index of the child to remove.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

RemoveChildAtIf<T>(T, bool, int)​

Conditionally removes the child at the specified index from the element.

public static T RemoveChildAtIf<T>(this T element, bool condition, int index) where T : VisualElement

Parameters​

element T

The element to modify.

condition bool

When true, the operation is performed; otherwise, the element is returned unchanged.

index int

The index of the child to remove.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

RemoveChildIf<T>(T, bool, VisualElement)​

Conditionally removes the specified child from the element.

public static T RemoveChildIf<T>(this T element, bool condition, VisualElement child) where T : VisualElement

Parameters​

element T

The element to modify.

condition bool

When true, the operation is performed; otherwise, the element is returned unchanged.

child VisualElement

The child element to remove.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

RemoveClass<T>(T, string)​

Removes a USS class from the element.

public static T RemoveClass<T>(this T element, string value) where T : VisualElement

Parameters​

element T

The element to modify.

value string

The USS class name to remove.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

RemoveItalicUnityFontStyleAndWeight<T>(T)​

Removes italic from unityFontStyleAndWeight, preserving any existing bold style.

public static T RemoveItalicUnityFontStyleAndWeight<T>(this T element) where T : VisualElement

Parameters​

element T

The element to modify.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

Remarks​

Transitions: Italic → Normal, BoldAndItalic → Bold. Other values are left unchanged.

RemoveStyleSheet<T>(T, StyleSheet)​

Removes a style sheet from styleSheets.

public static T RemoveStyleSheet<T>(this T element, StyleSheet value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleSheet

The style sheet to remove.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

RemoveStyleSheetFromResources<T>(T, string)​

Loads a StyleSheet from Resources and removes it from styleSheets.

public static T RemoveStyleSheetFromResources<T>(this T element, string path) where T : VisualElement

Parameters​

element T

The element to modify.

path string

The Resources-relative path to the style sheet asset.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

Remarks​

Logs a warning and leaves the element unchanged when no asset is found at path.

SetAlignContent<T>(T, StyleEnum<Align>)​

Sets alignContent.

public static T SetAlignContent<T>(this T element, StyleEnum<Align> value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleEnum<Align>

The content alignment to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetAlignContent<T>(T, Align)​

Sets alignContent.

public static T SetAlignContent<T>(this T element, Align value) where T : VisualElement

Parameters​

element T

The element to modify.

value Align

The content alignment to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetAlignItems<T>(T, StyleEnum<Align>)​

Sets alignItems.

public static T SetAlignItems<T>(this T element, StyleEnum<Align> value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleEnum<Align>

The children alignment to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetAlignItems<T>(T, Align)​

Sets alignItems.

public static T SetAlignItems<T>(this T element, Align value) where T : VisualElement

Parameters​

element T

The element to modify.

value Align

The children alignment to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetAlignSelf<T>(T, StyleEnum<Align>)​

Sets alignSelf.

public static T SetAlignSelf<T>(this T element, StyleEnum<Align> value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleEnum<Align>

The alignment to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetAlignSelf<T>(T, Align)​

Sets alignSelf.

public static T SetAlignSelf<T>(this T element, Align value) where T : VisualElement

Parameters​

element T

The element to modify.

value Align

The alignment to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetAspectRatio<T>(T, StyleRatio)​

Sets aspectRatio.

public static T SetAspectRatio<T>(this T element, StyleRatio value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleRatio

The aspect ratio to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetBackgroundColor<T>(T, StyleColor)​

Sets backgroundColor.

public static T SetBackgroundColor<T>(this T element, StyleColor value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleColor

The background color to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetBackgroundColor<T>(T, string)​

Sets backgroundColor from an HTML color string.

public static T SetBackgroundColor<T>(this T element, string value) where T : VisualElement

Parameters​

element T

The element to modify.

value string

The HTML color string, such as #FF0000 or red.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

Remarks​

Logs a warning and leaves the element unchanged when value cannot be parsed.

SetBackgroundImage<T>(T, StyleBackground)​

Sets backgroundImage.

public static T SetBackgroundImage<T>(this T element, StyleBackground value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleBackground

The background image to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetBackgroundImageFromResources<T>(T, string)​

Loads a Texture2D from Resources and sets the backgroundImage property.

public static T SetBackgroundImageFromResources<T>(this T element, string path) where T : VisualElement

Parameters​

element T

The element to modify.

path string

The Resources path of the texture to load.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

Remarks​

Logs a warning and leaves the element unchanged when no asset is found at path.

SetBackgroundPosition<T>(T, StyleBackgroundPosition)​

Sets backgroundPositionX and backgroundPositionY.

public static T SetBackgroundPosition<T>(this T element, StyleBackgroundPosition value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleBackgroundPosition

The background position to apply to both axes.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetBackgroundPosition<T>(T, StyleBackgroundPosition?, StyleBackgroundPosition?)​

Sets backgroundPositionX and backgroundPositionY.

public static T SetBackgroundPosition<T>(this T element, StyleBackgroundPosition? x = null, StyleBackgroundPosition? y = null) where T : VisualElement

Parameters​

element T

The element to modify.

x StyleBackgroundPosition?

The horizontal background position, or null to leave unchanged.

y StyleBackgroundPosition?

The vertical background position, or null to leave unchanged.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetBackgroundPositionX<T>(T, StyleBackgroundPosition)​

Sets backgroundPositionX.

public static T SetBackgroundPositionX<T>(this T element, StyleBackgroundPosition value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleBackgroundPosition

The horizontal background position to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetBackgroundPositionY<T>(T, StyleBackgroundPosition)​

Sets backgroundPositionY.

public static T SetBackgroundPositionY<T>(this T element, StyleBackgroundPosition value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleBackgroundPosition

The vertical background position to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetBackgroundRepeat<T>(T, StyleBackgroundRepeat)​

Sets backgroundRepeat.

public static T SetBackgroundRepeat<T>(this T element, StyleBackgroundRepeat value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleBackgroundRepeat

The background repeat mode to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetBackgroundSize<T>(T, StyleBackgroundSize)​

Sets backgroundSize.

public static T SetBackgroundSize<T>(this T element, StyleBackgroundSize value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleBackgroundSize

The background size to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetBorderColor<T>(T, StyleColor)​

Sets borderTopColor, borderRightColor, borderBottomColor and borderLeftColor.

public static T SetBorderColor<T>(this T element, StyleColor value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleColor

The border color to apply to all sides.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetBorderColor<T>(T, string)​

Sets the border color on all sides from an HTML color string.

public static T SetBorderColor<T>(this T element, string value) where T : VisualElement

Parameters​

element T

The element to modify.

value string

The HTML color string, such as #FF0000 or red.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

Remarks​

Logs a warning and leaves the element unchanged when value cannot be parsed.

SetBorderColor<T>(T, StyleColor?, StyleColor?, StyleColor?, StyleColor?)​

Sets borderTopColor, borderRightColor, borderBottomColor and borderLeftColor.

public static T SetBorderColor<T>(this T element, StyleColor? top = null, StyleColor? right = null, StyleColor? bottom = null, StyleColor? left = null) where T : VisualElement

Parameters​

element T

The element to modify.

top StyleColor?

The top border color, or null to leave unchanged.

right StyleColor?

The right border color, or null to leave unchanged.

bottom StyleColor?

The bottom border color, or null to leave unchanged.

left StyleColor?

The left border color, or null to leave unchanged.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetBorderColorBottom<T>(T, StyleColor)​

Sets borderBottomColor.

public static T SetBorderColorBottom<T>(this T element, StyleColor value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleColor

The bottom border color to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetBorderColorBottom<T>(T, string)​

Sets the bottom border color from an HTML color string.

public static T SetBorderColorBottom<T>(this T element, string value) where T : VisualElement

Parameters​

element T

The element to modify.

value string

The HTML color string, such as #FF0000 or red.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

Remarks​

Logs a warning and leaves the element unchanged when value cannot be parsed.

SetBorderColorLeft<T>(T, StyleColor)​

Sets borderLeftColor.

public static T SetBorderColorLeft<T>(this T element, StyleColor value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleColor

The left border color to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetBorderColorLeft<T>(T, string)​

Sets the left border color from an HTML color string.

public static T SetBorderColorLeft<T>(this T element, string value) where T : VisualElement

Parameters​

element T

The element to modify.

value string

The HTML color string, such as #FF0000 or red.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

Remarks​

Logs a warning and leaves the element unchanged when value cannot be parsed.

SetBorderColorRight<T>(T, StyleColor)​

Sets borderRightColor.

public static T SetBorderColorRight<T>(this T element, StyleColor value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleColor

The right border color to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetBorderColorRight<T>(T, string)​

Sets the right border color from an HTML color string.

public static T SetBorderColorRight<T>(this T element, string value) where T : VisualElement

Parameters​

element T

The element to modify.

value string

The HTML color string, such as #FF0000 or red.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

Remarks​

Logs a warning and leaves the element unchanged when value cannot be parsed.

SetBorderColorTop<T>(T, StyleColor)​

Sets borderTopColor.

public static T SetBorderColorTop<T>(this T element, StyleColor value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleColor

The top border color to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetBorderColorTop<T>(T, string)​

Sets the top border color from an HTML color string.

public static T SetBorderColorTop<T>(this T element, string value) where T : VisualElement

Parameters​

element T

The element to modify.

value string

The HTML color string, such as #FF0000 or red.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

Remarks​

Logs a warning and leaves the element unchanged when value cannot be parsed.

SetBorderColorX<T>(T, StyleColor)​

Sets borderRightColor and borderLeftColor.

public static T SetBorderColorX<T>(this T element, StyleColor value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleColor

The border color to apply to the left and right sides.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetBorderColorX<T>(T, string)​

Sets the left and right border colors from an HTML color string.

public static T SetBorderColorX<T>(this T element, string value) where T : VisualElement

Parameters​

element T

The element to modify.

value string

The HTML color string, such as #FF0000 or red.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

Remarks​

Logs a warning and leaves the element unchanged when value cannot be parsed.

SetBorderColorY<T>(T, StyleColor)​

Sets borderTopColor and borderBottomColor.

public static T SetBorderColorY<T>(this T element, StyleColor value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleColor

The border color to apply to the top and bottom sides.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetBorderColorY<T>(T, string)​

Sets the top and bottom border colors from an HTML color string.

public static T SetBorderColorY<T>(this T element, string value) where T : VisualElement

Parameters​

element T

The element to modify.

value string

The HTML color string, such as #FF0000 or red.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

Remarks​

Logs a warning and leaves the element unchanged when value cannot be parsed.

SetBorderRadius<T>(T, StyleLength)​

Sets borderTopLeftRadius, borderTopRightRadius, borderBottomRightRadius and borderBottomLeftRadius.

public static T SetBorderRadius<T>(this T element, StyleLength value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleLength

The border radius to apply to all corners.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetBorderRadius<T>(T, StyleLength?, StyleLength?, StyleLength?, StyleLength?)​

Sets borderTopLeftRadius, borderTopRightRadius, borderBottomRightRadius and borderBottomLeftRadius.

public static T SetBorderRadius<T>(this T element, StyleLength? topLeft = null, StyleLength? topRight = null, StyleLength? bottomRight = null, StyleLength? bottomLeft = null) where T : VisualElement

Parameters​

element T

The element to modify.

topLeft StyleLength?

The top-left radius, or null to leave unchanged.

topRight StyleLength?

The top-right radius, or null to leave unchanged.

bottomRight StyleLength?

The bottom-right radius, or null to leave unchanged.

bottomLeft StyleLength?

The bottom-left radius, or null to leave unchanged.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetBorderRadiusBottom<T>(T, StyleLength)​

Sets borderBottomRightRadius and borderBottomLeftRadius.

public static T SetBorderRadiusBottom<T>(this T element, StyleLength value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleLength

The radius to apply to both bottom corners.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetBorderRadiusBottomLeft<T>(T, StyleLength)​

Sets borderBottomLeftRadius.

public static T SetBorderRadiusBottomLeft<T>(this T element, StyleLength value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleLength

The bottom-left corner radius to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetBorderRadiusBottomRight<T>(T, StyleLength)​

Sets borderBottomRightRadius.

public static T SetBorderRadiusBottomRight<T>(this T element, StyleLength value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleLength

The bottom-right corner radius to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetBorderRadiusLeft<T>(T, StyleLength)​

Sets borderTopLeftRadius and borderBottomLeftRadius.

public static T SetBorderRadiusLeft<T>(this T element, StyleLength value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleLength

The radius to apply to both left corners.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetBorderRadiusRight<T>(T, StyleLength)​

Sets borderTopRightRadius and borderBottomRightRadius.

public static T SetBorderRadiusRight<T>(this T element, StyleLength value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleLength

The radius to apply to both right corners.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetBorderRadiusTop<T>(T, StyleLength)​

Sets borderTopLeftRadius and borderTopRightRadius.

public static T SetBorderRadiusTop<T>(this T element, StyleLength value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleLength

The radius to apply to both top corners.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetBorderRadiusTopLeft<T>(T, StyleLength)​

Sets borderTopLeftRadius.

public static T SetBorderRadiusTopLeft<T>(this T element, StyleLength value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleLength

The top-left corner radius to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetBorderRadiusTopRight<T>(T, StyleLength)​

Sets borderTopRightRadius.

public static T SetBorderRadiusTopRight<T>(this T element, StyleLength value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleLength

The top-right corner radius to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetBorderWidth<T>(T, StyleFloat)​

Sets borderTopWidth, borderRightWidth, borderBottomWidth and borderLeftWidth.

public static T SetBorderWidth<T>(this T element, StyleFloat value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleFloat

The border width to apply to all sides.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetBorderWidth<T>(T, StyleFloat?, StyleFloat?, StyleFloat?, StyleFloat?)​

Sets borderTopWidth, borderRightWidth, borderBottomWidth and borderLeftWidth.

public static T SetBorderWidth<T>(this T element, StyleFloat? top = null, StyleFloat? right = null, StyleFloat? bottom = null, StyleFloat? left = null) where T : VisualElement

Parameters​

element T

The element to modify.

top StyleFloat?

The top border width, or null to leave unchanged.

right StyleFloat?

The right border width, or null to leave unchanged.

bottom StyleFloat?

The bottom border width, or null to leave unchanged.

left StyleFloat?

The left border width, or null to leave unchanged.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetBorderWidthBottom<T>(T, StyleFloat)​

Sets borderBottomWidth.

public static T SetBorderWidthBottom<T>(this T element, StyleFloat value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleFloat

The bottom border width to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetBorderWidthLeft<T>(T, StyleFloat)​

Sets borderLeftWidth.

public static T SetBorderWidthLeft<T>(this T element, StyleFloat value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleFloat

The left border width to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetBorderWidthRight<T>(T, StyleFloat)​

Sets borderRightWidth.

public static T SetBorderWidthRight<T>(this T element, StyleFloat value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleFloat

The right border width to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetBorderWidthTop<T>(T, StyleFloat)​

Sets borderTopWidth.

public static T SetBorderWidthTop<T>(this T element, StyleFloat value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleFloat

The top border width to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetBorderWidthX<T>(T, StyleFloat)​

Sets borderLeftWidth and borderRightWidth.

public static T SetBorderWidthX<T>(this T element, StyleFloat value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleFloat

The border width to apply to the left and right sides.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetBorderWidthY<T>(T, StyleFloat)​

Sets borderTopWidth and borderBottomWidth.

public static T SetBorderWidthY<T>(this T element, StyleFloat value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleFloat

The border width to apply to the top and bottom sides.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetBottom<T>(T, StyleLength)​

Sets bottom.

public static T SetBottom<T>(this T element, StyleLength value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleLength

The bottom offset to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetColor<T>(T, StyleColor)​

Sets color.

public static T SetColor<T>(this T element, StyleColor value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleColor

The text color to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetColor<T>(T, string)​

Sets color from an HTML color string.

public static T SetColor<T>(this T element, string value) where T : VisualElement

Parameters​

element T

The element to modify.

value string

The HTML color string, such as #FF0000 or red.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

Remarks​

Logs a warning and leaves the element unchanged when value cannot be parsed.

SetCursor<T>(T, StyleCursor)​

Sets cursor.

public static T SetCursor<T>(this T element, StyleCursor value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleCursor

The cursor style to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetDataSource<T>(T, object)​

Sets dataSource.

public static T SetDataSource<T>(this T element, object value) where T : VisualElement

Parameters​

element T

The element to modify.

value object

The data source to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetDataSourcePath<T>(T, PropertyPath)​

Sets dataSourcePath.

public static T SetDataSourcePath<T>(this T element, PropertyPath value) where T : VisualElement

Parameters​

element T

The element to modify.

value PropertyPath

The data source path to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetDataSourceType<T>(T, Type)​

Sets dataSourceType.

public static T SetDataSourceType<T>(this T element, Type value) where T : VisualElement

Parameters​

element T

The element to modify.

value Type

The data source type to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

Remarks​

The type is only a design-time hint for the UI Builder; it does not affect runtime binding.

SetDisablePlayModeTint<T>(T, bool)​

Sets disablePlayModeTint.

public static T SetDisablePlayModeTint<T>(this T element, bool value) where T : VisualElement

Parameters​

element T

The element to modify.

value bool

When true, the play-mode tint is not applied to the element and its children.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetDisplay<T>(T, StyleEnum<DisplayStyle>)​

Sets display.

public static T SetDisplay<T>(this T element, StyleEnum<DisplayStyle> value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleEnum<DisplayStyle>

The display mode to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetDisplay<T>(T, DisplayStyle)​

Sets display.

public static T SetDisplay<T>(this T element, DisplayStyle value) where T : VisualElement

Parameters​

element T

The element to modify.

value DisplayStyle

The display mode to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetDistance<T>(T, StyleLength)​

Sets top, right, bottom and left.

public static T SetDistance<T>(this T element, StyleLength value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleLength

The distance to apply to all sides.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetDistance<T>(T, StyleLength?, StyleLength?, StyleLength?, StyleLength?)​

Sets top, right, bottom and left.

public static T SetDistance<T>(this T element, StyleLength? top = null, StyleLength? right = null, StyleLength? bottom = null, StyleLength? left = null) where T : VisualElement

Parameters​

element T

The element to modify.

top StyleLength?

The top offset, or null to leave unchanged.

right StyleLength?

The right offset, or null to leave unchanged.

bottom StyleLength?

The bottom offset, or null to leave unchanged.

left StyleLength?

The left offset, or null to leave unchanged.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetDistanceX<T>(T, StyleLength)​

Sets right and left.

public static T SetDistanceX<T>(this T element, StyleLength value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleLength

The horizontal offset to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetDistanceY<T>(T, StyleLength)​

Sets top and bottom.

public static T SetDistanceY<T>(this T element, StyleLength value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleLength

The vertical offset to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetEnabledSelf<T>(T, bool)​

Enables or disables the element via SetEnabled.

public static T SetEnabledSelf<T>(this T element, bool value) where T : VisualElement

Parameters​

element T

The element to modify.

value bool

When true, the element is enabled; a disabled element receives most events no longer.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetFilter<T>(T, StyleList<FilterFunction>)​

Sets filter.

public static T SetFilter<T>(this T element, StyleList<FilterFunction> value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleList<FilterFunction>

The filter effects to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetFlexBasis<T>(T, StyleLength)​

Sets flexBasis.

public static T SetFlexBasis<T>(this T element, StyleLength value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleLength

The flex basis to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetFlexDirection<T>(T, StyleEnum<FlexDirection>)​

Sets flexDirection.

public static T SetFlexDirection<T>(this T element, StyleEnum<FlexDirection> value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleEnum<FlexDirection>

The flex direction to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetFlexDirection<T>(T, FlexDirection)​

Sets flexDirection.

public static T SetFlexDirection<T>(this T element, FlexDirection value) where T : VisualElement

Parameters​

element T

The element to modify.

value FlexDirection

The flex direction to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetFlexGrow<T>(T, StyleFloat)​

Sets flexGrow.

public static T SetFlexGrow<T>(this T element, StyleFloat value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleFloat

The flex grow factor to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetFlexShrink<T>(T, StyleFloat)​

Sets flexShrink.

public static T SetFlexShrink<T>(this T element, StyleFloat value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleFloat

The flex shrink factor to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetFlexWrap<T>(T, StyleEnum<Wrap>)​

Sets flexWrap.

public static T SetFlexWrap<T>(this T element, StyleEnum<Wrap> value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleEnum<Wrap>

The flex wrap mode to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetFlexWrap<T>(T, Wrap)​

Sets flexWrap.

public static T SetFlexWrap<T>(this T element, Wrap value) where T : VisualElement

Parameters​

element T

The element to modify.

value Wrap

The flex wrap mode to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetFontSize<T>(T, StyleLength)​

Sets fontSize.

public static T SetFontSize<T>(this T element, StyleLength value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleLength

The font size to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetHeight<T>(T, StyleLength)​

Sets height.

public static T SetHeight<T>(this T element, StyleLength value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleLength

The height to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetJustifyContent<T>(T, StyleEnum<Justify>)​

Sets justifyContent.

public static T SetJustifyContent<T>(this T element, StyleEnum<Justify> value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleEnum<Justify>

The justify content mode to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetJustifyContent<T>(T, Justify)​

Sets justifyContent.

public static T SetJustifyContent<T>(this T element, Justify value) where T : VisualElement

Parameters​

element T

The element to modify.

value Justify

The justify content mode to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetLanguageDirection<T>(T, LanguageDirection)​

Sets languageDirection.

public static T SetLanguageDirection<T>(this T element, LanguageDirection value) where T : VisualElement

Parameters​

element T

The element to modify.

value LanguageDirection

The language direction to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetLeft<T>(T, StyleLength)​

Sets left.

public static T SetLeft<T>(this T element, StyleLength value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleLength

The left offset to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetLetterSpacing<T>(T, StyleLength)​

Sets letterSpacing.

public static T SetLetterSpacing<T>(this T element, StyleLength value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleLength

The letter spacing to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetMargin<T>(T, StyleLength)​

Sets marginTop, marginRight, marginBottom and marginLeft.

public static T SetMargin<T>(this T element, StyleLength value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleLength

The margin to apply to all sides.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetMargin<T>(T, StyleLength?, StyleLength?, StyleLength?, StyleLength?)​

Sets marginTop, marginRight, marginBottom and marginLeft.

public static T SetMargin<T>(this T element, StyleLength? top = null, StyleLength? right = null, StyleLength? bottom = null, StyleLength? left = null) where T : VisualElement

Parameters​

element T

The element to modify.

top StyleLength?

The top margin, or null to leave unchanged.

right StyleLength?

The right margin, or null to leave unchanged.

bottom StyleLength?

The bottom margin, or null to leave unchanged.

left StyleLength?

The left margin, or null to leave unchanged.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetMarginBottom<T>(T, StyleLength)​

Sets marginBottom.

public static T SetMarginBottom<T>(this T element, StyleLength value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleLength

The bottom margin to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetMarginLeft<T>(T, StyleLength)​

Sets marginLeft.

public static T SetMarginLeft<T>(this T element, StyleLength value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleLength

The left margin to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetMarginRight<T>(T, StyleLength)​

Sets marginRight.

public static T SetMarginRight<T>(this T element, StyleLength value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleLength

The right margin to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetMarginTop<T>(T, StyleLength)​

Sets marginTop.

public static T SetMarginTop<T>(this T element, StyleLength value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleLength

The top margin to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetMarginX<T>(T, StyleLength)​

Sets marginRight and marginLeft.

public static T SetMarginX<T>(this T element, StyleLength value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleLength

The horizontal margin to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetMarginY<T>(T, StyleLength)​

Sets marginTop and marginBottom.

public static T SetMarginY<T>(this T element, StyleLength value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleLength

The vertical margin to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetMaxHeight<T>(T, StyleLength)​

Sets maxHeight.

public static T SetMaxHeight<T>(this T element, StyleLength value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleLength

The maximum height to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetMaxSize<T>(T, StyleLength)​

Sets maxWidth and maxHeight.

public static T SetMaxSize<T>(this T element, StyleLength value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleLength

The maximum size to apply to both width and height.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetMaxSize<T>(T, StyleLength?, StyleLength?)​

Sets maxWidth and maxHeight.

public static T SetMaxSize<T>(this T element, StyleLength? maxWidth = null, StyleLength? maxHeight = null) where T : VisualElement

Parameters​

element T

The element to modify.

maxWidth StyleLength?

The maximum width to set, or null to leave unchanged.

maxHeight StyleLength?

The maximum height to set, or null to leave unchanged.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetMaxWidth<T>(T, StyleLength)​

Sets maxWidth.

public static T SetMaxWidth<T>(this T element, StyleLength value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleLength

The maximum width to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetMinHeight<T>(T, StyleLength)​

Sets minHeight.

public static T SetMinHeight<T>(this T element, StyleLength value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleLength

The minimum height to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetMinSize<T>(T, StyleLength)​

Sets minWidth and minHeight.

public static T SetMinSize<T>(this T element, StyleLength value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleLength

The minimum size to apply to both width and height.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetMinSize<T>(T, StyleLength?, StyleLength?)​

Sets minWidth and minHeight.

public static T SetMinSize<T>(this T element, StyleLength? minWidth = null, StyleLength? minHeight = null) where T : VisualElement

Parameters​

element T

The element to modify.

minWidth StyleLength?

The minimum width to set, or null to leave unchanged.

minHeight StyleLength?

The minimum height to set, or null to leave unchanged.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetMinWidth<T>(T, StyleLength)​

Sets minWidth.

public static T SetMinWidth<T>(this T element, StyleLength value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleLength

The minimum width to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetName<T>(T, string)​

Sets name.

public static T SetName<T>(this T element, string value) where T : VisualElement

Parameters​

element T

The element to modify.

value string

The name to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetNormalUnityFontStyleAndWeight<T>(T)​

Sets unityFontStyleAndWeight to Normal, removing bold and italic.

public static T SetNormalUnityFontStyleAndWeight<T>(this T element) where T : VisualElement

Parameters​

element T

The element to modify.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

Remarks​

Sets the value unconditionally, regardless of any current bold or italic style.

SetOpacity<T>(T, StyleFloat)​

Sets opacity.

public static T SetOpacity<T>(this T element, StyleFloat value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleFloat

The opacity to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetOverflow<T>(T, StyleEnum<Overflow>)​

Sets overflow.

public static T SetOverflow<T>(this T element, StyleEnum<Overflow> value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleEnum<Overflow>

The overflow behavior to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetOverflow<T>(T, Overflow)​

Sets overflow.

public static T SetOverflow<T>(this T element, Overflow value) where T : VisualElement

Parameters​

element T

The element to modify.

value Overflow

The overflow behavior to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetPadding<T>(T, StyleLength)​

Sets paddingTop, paddingRight, paddingBottom and paddingLeft.

public static T SetPadding<T>(this T element, StyleLength value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleLength

The padding to apply to all sides.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetPadding<T>(T, StyleLength?, StyleLength?, StyleLength?, StyleLength?)​

Sets paddingTop, paddingRight, paddingBottom and paddingLeft.

public static T SetPadding<T>(this T element, StyleLength? top = null, StyleLength? right = null, StyleLength? bottom = null, StyleLength? left = null) where T : VisualElement

Parameters​

element T

The element to modify.

top StyleLength?

The top padding, or null to leave unchanged.

right StyleLength?

The right padding, or null to leave unchanged.

bottom StyleLength?

The bottom padding, or null to leave unchanged.

left StyleLength?

The left padding, or null to leave unchanged.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetPaddingBottom<T>(T, StyleLength)​

Sets paddingBottom.

public static T SetPaddingBottom<T>(this T element, StyleLength value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleLength

The bottom padding to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetPaddingLeft<T>(T, StyleLength)​

Sets paddingLeft.

public static T SetPaddingLeft<T>(this T element, StyleLength value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleLength

The left padding to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetPaddingRight<T>(T, StyleLength)​

Sets paddingRight.

public static T SetPaddingRight<T>(this T element, StyleLength value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleLength

The right padding to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetPaddingTop<T>(T, StyleLength)​

Sets paddingTop.

public static T SetPaddingTop<T>(this T element, StyleLength value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleLength

The top padding to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetPaddingX<T>(T, StyleLength)​

Sets paddingRight and paddingLeft.

public static T SetPaddingX<T>(this T element, StyleLength value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleLength

The horizontal padding to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetPaddingY<T>(T, StyleLength)​

Sets paddingTop and paddingBottom.

public static T SetPaddingY<T>(this T element, StyleLength value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleLength

The vertical padding to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetPickingMode<T>(T, PickingMode)​

Sets pickingMode.

public static T SetPickingMode<T>(this T element, PickingMode value) where T : VisualElement

Parameters​

element T

The element to modify.

value PickingMode

The picking mode to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetPosition<T>(T, StyleEnum<Position>)​

Sets position.

public static T SetPosition<T>(this T element, StyleEnum<Position> value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleEnum<Position>

The position type to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetPosition<T>(T, Position)​

Sets position.

public static T SetPosition<T>(this T element, Position value) where T : VisualElement

Parameters​

element T

The element to modify.

value Position

The position type to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetRight<T>(T, StyleLength)​

Sets right.

public static T SetRight<T>(this T element, StyleLength value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleLength

The right offset to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetRotate<T>(T, StyleRotate)​

Sets rotate.

public static T SetRotate<T>(this T element, StyleRotate value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleRotate

The rotation to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetScale<T>(T, StyleScale)​

Sets scale.

public static T SetScale<T>(this T element, StyleScale value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleScale

The scale transformation to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetSize<T>(T, StyleLength)​

Sets width and height.

public static T SetSize<T>(this T element, StyleLength value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleLength

The size to apply to both width and height.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetSize<T>(T, StyleLength?, StyleLength?)​

Sets width and height.

public static T SetSize<T>(this T element, StyleLength? width = null, StyleLength? height = null) where T : VisualElement

Parameters​

element T

The element to modify.

width StyleLength?

The width to set, or null to leave unchanged.

height StyleLength?

The height to set, or null to leave unchanged.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetTextOverflow<T>(T, StyleEnum<TextOverflow>)​

Sets textOverflow.

public static T SetTextOverflow<T>(this T element, StyleEnum<TextOverflow> value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleEnum<TextOverflow>

The text overflow mode to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetTextOverflow<T>(T, TextOverflow)​

Sets textOverflow.

public static T SetTextOverflow<T>(this T element, TextOverflow value) where T : VisualElement

Parameters​

element T

The element to modify.

value TextOverflow

The text overflow mode to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetTextShadow<T>(T, StyleTextShadow)​

Sets textShadow.

public static T SetTextShadow<T>(this T element, StyleTextShadow value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleTextShadow

The text shadow to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetTooltip<T>(T, string)​

Sets tooltip.

public static T SetTooltip<T>(this T element, string value) where T : VisualElement

Parameters​

element T

The element to modify.

value string

The tooltip text to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetTop<T>(T, StyleLength)​

Sets top.

public static T SetTop<T>(this T element, StyleLength value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleLength

The top offset to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetTransformOrigin<T>(T, StyleTransformOrigin)​

Sets transformOrigin.

public static T SetTransformOrigin<T>(this T element, StyleTransformOrigin value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleTransformOrigin

The transform origin to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetTransitionDelay<T>(T, StyleList<TimeValue>)​

Sets transitionDelay.

public static T SetTransitionDelay<T>(this T element, StyleList<TimeValue> value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleList<TimeValue>

The transition delays to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetTransitionDuration<T>(T, StyleList<TimeValue>)​

Sets transitionDuration.

public static T SetTransitionDuration<T>(this T element, StyleList<TimeValue> value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleList<TimeValue>

The transition durations to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetTransitionProperty<T>(T, StyleList<StylePropertyName>)​

Sets transitionProperty.

public static T SetTransitionProperty<T>(this T element, StyleList<StylePropertyName> value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleList<StylePropertyName>

The transition properties to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetTransitionTimingFunction<T>(T, StyleList<EasingFunction>)​

Sets transitionTimingFunction.

public static T SetTransitionTimingFunction<T>(this T element, StyleList<EasingFunction> value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleList<EasingFunction>

The transition timing functions to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetTranslate<T>(T, StyleTranslate)​

Sets translate.

public static T SetTranslate<T>(this T element, StyleTranslate value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleTranslate

The translation to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetUnityBackgroundImageTintColor<T>(T, StyleColor)​

Sets unityBackgroundImageTintColor.

public static T SetUnityBackgroundImageTintColor<T>(this T element, StyleColor value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleColor

The background image tint color to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetUnityBackgroundImageTintColor<T>(T, string)​

Sets the background image tint color from an HTML color string.

public static T SetUnityBackgroundImageTintColor<T>(this T element, string value) where T : VisualElement

Parameters​

element T

The element to modify.

value string

The HTML color string, such as #FF0000 or red.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

Remarks​

Logs a warning and leaves the element unchanged when value cannot be parsed.

SetUnityEditorTextRenderingMode<T>(T, StyleEnum<EditorTextRenderingMode>)​

Sets unityEditorTextRenderingMode.

public static T SetUnityEditorTextRenderingMode<T>(this T element, StyleEnum<EditorTextRenderingMode> value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleEnum<EditorTextRenderingMode>

The editor text rendering mode to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetUnityEditorTextRenderingMode<T>(T, EditorTextRenderingMode)​

Sets unityEditorTextRenderingMode.

public static T SetUnityEditorTextRenderingMode<T>(this T element, EditorTextRenderingMode value) where T : VisualElement

Parameters​

element T

The element to modify.

value EditorTextRenderingMode

The editor text rendering mode to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetUnityFont<T>(T, StyleFont)​

Sets unityFont.

public static T SetUnityFont<T>(this T element, StyleFont value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleFont

The font to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetUnityFontDefinition<T>(T, StyleFontDefinition)​

Sets unityFontDefinition.

public static T SetUnityFontDefinition<T>(this T element, StyleFontDefinition value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleFontDefinition

The font definition to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetUnityFontStyleAndWeight<T>(T, StyleEnum<FontStyle>)​

Sets unityFontStyleAndWeight.

public static T SetUnityFontStyleAndWeight<T>(this T element, StyleEnum<FontStyle> value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleEnum<FontStyle>

The font style and weight to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetUnityFontStyleAndWeight<T>(T, FontStyle)​

Sets unityFontStyleAndWeight.

public static T SetUnityFontStyleAndWeight<T>(this T element, FontStyle value) where T : VisualElement

Parameters​

element T

The element to modify.

value FontStyle

The font style and weight to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetUnityMaterial<T>(T, StyleMaterialDefinition)​

Sets unityMaterial.

public static T SetUnityMaterial<T>(this T element, StyleMaterialDefinition value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleMaterialDefinition

The material to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetUnityOverflowClipBox<T>(T, StyleEnum<OverflowClipBox>)​

Sets unityOverflowClipBox.

public static T SetUnityOverflowClipBox<T>(this T element, StyleEnum<OverflowClipBox> value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleEnum<OverflowClipBox>

The overflow clip box to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetUnityOverflowClipBox<T>(T, OverflowClipBox)​

Sets unityOverflowClipBox.

public static T SetUnityOverflowClipBox<T>(this T element, OverflowClipBox value) where T : VisualElement

Parameters​

element T

The element to modify.

value OverflowClipBox

The overflow clip box to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetUnityParagraphSpacing<T>(T, StyleLength)​

Sets unityParagraphSpacing.

public static T SetUnityParagraphSpacing<T>(this T element, StyleLength value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleLength

The paragraph spacing to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetUnitySlice<T>(T, StyleInt)​

Sets unitySliceTop, unitySliceRight, unitySliceBottom and unitySliceLeft.

public static T SetUnitySlice<T>(this T element, StyleInt value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleInt

The slice width to apply to all sides.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetUnitySlice<T>(T, StyleInt?, StyleInt?, StyleInt?, StyleInt?)​

Sets unitySliceTop, unitySliceRight, unitySliceBottom and unitySliceLeft.

public static T SetUnitySlice<T>(this T element, StyleInt? top = null, StyleInt? right = null, StyleInt? bottom = null, StyleInt? left = null) where T : VisualElement

Parameters​

element T

The element to modify.

top StyleInt?

The top slice width, or null to leave unchanged.

right StyleInt?

The right slice width, or null to leave unchanged.

bottom StyleInt?

The bottom slice width, or null to leave unchanged.

left StyleInt?

The left slice width, or null to leave unchanged.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetUnitySliceBottom<T>(T, StyleInt)​

Sets unitySliceBottom.

public static T SetUnitySliceBottom<T>(this T element, StyleInt value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleInt

The bottom slice width to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetUnitySliceLeft<T>(T, StyleInt)​

Sets unitySliceLeft.

public static T SetUnitySliceLeft<T>(this T element, StyleInt value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleInt

The left slice width to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetUnitySliceRight<T>(T, StyleInt)​

Sets unitySliceRight.

public static T SetUnitySliceRight<T>(this T element, StyleInt value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleInt

The right slice width to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetUnitySliceScale<T>(T, StyleFloat)​

Sets unitySliceScale.

public static T SetUnitySliceScale<T>(this T element, StyleFloat value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleFloat

The slice scale to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetUnitySliceTop<T>(T, StyleInt)​

Sets unitySliceTop.

public static T SetUnitySliceTop<T>(this T element, StyleInt value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleInt

The top slice width to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetUnitySliceType<T>(T, StyleEnum<SliceType>)​

Sets unitySliceType.

public static T SetUnitySliceType<T>(this T element, StyleEnum<SliceType> value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleEnum<SliceType>

The slice type to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetUnitySliceType<T>(T, SliceType)​

Sets unitySliceType.

public static T SetUnitySliceType<T>(this T element, SliceType value) where T : VisualElement

Parameters​

element T

The element to modify.

value SliceType

The slice type to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetUnitySliceX<T>(T, StyleInt)​

Sets unitySliceRight and unitySliceLeft.

public static T SetUnitySliceX<T>(this T element, StyleInt value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleInt

The horizontal slice width to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetUnitySliceY<T>(T, StyleInt)​

Sets unitySliceTop and unitySliceBottom.

public static T SetUnitySliceY<T>(this T element, StyleInt value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleInt

The vertical slice width to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetUnityTextAlign<T>(T, StyleEnum<TextAnchor>)​

Sets unityTextAlign.

public static T SetUnityTextAlign<T>(this T element, StyleEnum<TextAnchor> value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleEnum<TextAnchor>

The text alignment to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetUnityTextAlign<T>(T, TextAnchor)​

Sets unityTextAlign.

public static T SetUnityTextAlign<T>(this T element, TextAnchor value) where T : VisualElement

Parameters​

element T

The element to modify.

value TextAnchor

The text alignment to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetUnityTextAutoSize<T>(T, StyleTextAutoSize)​

Sets unityTextAutoSize.

public static T SetUnityTextAutoSize<T>(this T element, StyleTextAutoSize value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleTextAutoSize

The text auto size settings to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetUnityTextGenerator<T>(T, StyleEnum<TextGeneratorType>)​

Sets unityTextGenerator.

public static T SetUnityTextGenerator<T>(this T element, StyleEnum<TextGeneratorType> value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleEnum<TextGeneratorType>

The text generator type to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetUnityTextGenerator<T>(T, TextGeneratorType)​

Sets unityTextGenerator.

public static T SetUnityTextGenerator<T>(this T element, TextGeneratorType value) where T : VisualElement

Parameters​

element T

The element to modify.

value TextGeneratorType

The text generator type to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetUnityTextOutlineColor<T>(T, StyleColor)​

Sets unityTextOutlineColor.

public static T SetUnityTextOutlineColor<T>(this T element, StyleColor value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleColor

The text outline color to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetUnityTextOutlineColor<T>(T, string)​

Sets the text outline color from an HTML color string.

public static T SetUnityTextOutlineColor<T>(this T element, string value) where T : VisualElement

Parameters​

element T

The element to modify.

value string

The HTML color string, such as #FF0000 or red.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

Remarks​

Logs a warning and leaves the element unchanged when value cannot be parsed.

SetUnityTextOutlineWidth<T>(T, StyleFloat)​

Sets unityTextOutlineWidth.

public static T SetUnityTextOutlineWidth<T>(this T element, StyleFloat value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleFloat

The text outline width to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetUnityTextOverflowPosition<T>(T, StyleEnum<TextOverflowPosition>)​

Sets unityTextOverflowPosition.

public static T SetUnityTextOverflowPosition<T>(this T element, StyleEnum<TextOverflowPosition> value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleEnum<TextOverflowPosition>

The text overflow position to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetUnityTextOverflowPosition<T>(T, TextOverflowPosition)​

Sets unityTextOverflowPosition.

public static T SetUnityTextOverflowPosition<T>(this T element, TextOverflowPosition value) where T : VisualElement

Parameters​

element T

The element to modify.

value TextOverflowPosition

The text overflow position to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetUsageHints<T>(T, UsageHints)​

Sets usageHints.

public static T SetUsageHints<T>(this T element, UsageHints value) where T : VisualElement

Parameters​

element T

The element to modify.

value UsageHints

The usage hints to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

Remarks​

Must be called before the element is added to a panel; afterwards the property is effectively read-only and throws on assignment.

SetUserData<T>(T, object)​

Sets userData.

public static T SetUserData<T>(this T element, object value) where T : VisualElement

Parameters​

element T

The element to modify.

value object

The user data to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetViewDataKey<T>(T, string)​

Sets viewDataKey.

public static T SetViewDataKey<T>(this T element, string value) where T : VisualElement

Parameters​

element T

The element to modify.

value string

The view data key to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetVisibility<T>(T, StyleEnum<Visibility>)​

Sets visibility.

public static T SetVisibility<T>(this T element, StyleEnum<Visibility> value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleEnum<Visibility>

The visibility to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetVisibility<T>(T, Visibility)​

Sets visibility.

public static T SetVisibility<T>(this T element, Visibility value) where T : VisualElement

Parameters​

element T

The element to modify.

value Visibility

The visibility to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetVisible<T>(T, bool)​

Sets visible.

public static T SetVisible<T>(this T element, bool value) where T : VisualElement

Parameters​

element T

The element to modify.

value bool

When true, the element is rendered.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetWhiteSpace<T>(T, StyleEnum<WhiteSpace>)​

Sets whiteSpace.

public static T SetWhiteSpace<T>(this T element, StyleEnum<WhiteSpace> value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleEnum<WhiteSpace>

The white-space mode to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetWhiteSpace<T>(T, WhiteSpace)​

Sets whiteSpace.

public static T SetWhiteSpace<T>(this T element, WhiteSpace value) where T : VisualElement

Parameters​

element T

The element to modify.

value WhiteSpace

The white-space mode to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetWidth<T>(T, StyleLength)​

Sets width.

public static T SetWidth<T>(this T element, StyleLength value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleLength

The width to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetWordSpacing<T>(T, StyleLength)​

Sets wordSpacing.

public static T SetWordSpacing<T>(this T element, StyleLength value) where T : VisualElement

Parameters​

element T

The element to modify.

value StyleLength

The word spacing to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

ToggleClass<T>(T, string)​

Adds the USS class when it is absent and removes it when it is present.

public static T ToggleClass<T>(this T element, string value) where T : VisualElement

Parameters​

element T

The element to modify.

value string

The USS class name to toggle.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

Содержание