Docs / UI

Glossary: BaseStyle

The members of BaseStyle, in alphabetical order.

Color legend plain property dependency property method

The abstract base of every style class. It has one property for each dependency property of BaseElement (Margin, DesiredWidth, DesiredHeight, MinWidth, MinHeight, MaxWidth, MaxHeight, HorizontalAlignment, VerticalAlignment, Visibility, Disabled, BackgroundColor, ForegroundColor, TexturesPath, Transparency, InheritState, HitTest, GridRow, GridColumn, GridRowSpan, GridColumnSpan, ZIndex, RepeatClicks, TimeBeforeRepeatStartsMs, TimeBetweenRepeatsMs, DoubleClickIntervalMs, CropOutsideOfParentBorder, IsResizable, ResizeWithElementContour, ResizeContourColor, ResizeAreaHalfWidth, DragType, CustomEffect), with the same names and types, so every style class has them too. Setting a property assigns it, even to the value it already has. The framework defaults of every style type include HitTest = true and CropOutsideOfParentBorder = true.

An abstract class. The styles page shows it in context.

Names are colored by what they are: a property, a method or an event; values and fields keep the plain color.

Properties

BackgroundColor 🠆

Color · The color the element’s background is filled with. Transparent (the default) fills nothing; lists, combo boxes, tooltips, progress bars and separators have a color of their own unless set (see default settings).

CropOutsideOfParentBorder 🠆

bool · Clips the element to its parent’s bounds. Without it the element may overflow its parent but is still clipped by whatever clips the parent (a scroll view, a window’s content area). On by default for every element with a style.

CustomEffect 🠆

Effect · A shader the element draws its background (or texture, an image’s picture) with. Setting it sets it on the children as well, and a child added later takes it. An effect with a ModulationColor parameter gets the draw color there.

DesiredHeight 🠆

int · The height in units. 0 (the default) fits the content, or stretches over the slot when VerticalAlignment is Stretch.

DesiredWidth 🠆

int · The width in units. 0 (the default) fits the content, or stretches over the slot when HorizontalAlignment is Stretch.

Disabled 🠆

bool · Stops the element and its subtree from showing states, raising mouse events and taking the keyboard, and draws them darker.

DoubleClickIntervalMs 🠆

int · The longest time in milliseconds between two left presses that make a double click. 300 by default; negative values are taken as 0.

DragType 🠆

DragType · Whether a press on the element drags something: nothing (the default), the element itself, or a drag and drop.

ForegroundColor 🠆

Color · The color of what the element draws over its background, such as a label’s text. An element drawn from textures tints them with it when it is not Transparent.

GridColumn 🠆

int · The column the element starts in, from 0.

GridColumnSpan 🠆

int · How many columns the element covers; values below 1 are taken as 1.

GridRow 🠆

int · The row the element starts in, from 0.

GridRowSpan 🠆

int · How many rows the element covers; values below 1 are taken as 1.

HitTest 🠆

bool · Whether the element itself takes the mouse. On by default for every element with a style; off for an element deriving from BaseElement directly.

HorizontalAlignment 🠆

HorizontalAlignment · Where the element sits in its slot horizontally, and whether it stretches over it. The default is Stretch.

InheritState 🠆

InheritState · Which states the element shows besides its own: its parent’s, its children’s, both or none (the default).

IsResizable 🠆

bool · Lets the user resize the element by dragging its edges and corners.

Margin 🠆

Margin · The space between the element and the edges of its slot. Which sides count is described above.

MaxHeight 🠆

int · The largest height the layout (and a resize) gives the element. 0 is no limit.

MaxWidth 🠆

int · The largest width the layout (and a resize) gives the element. 0 is no limit.

MinHeight 🠆

int · The smallest height the layout (and a resize) gives the element. 0 is no limit.

MinWidth 🠆

int · The smallest width the layout (and a resize) gives the element. 0 is no limit.

RepeatClicks 🠆

bool · Raises OnClick on the press and repeatedly while the left button is held, instead of once on release. Off by default.

ResizeAreaHalfWidth 🠆

int · How far the resize areas reach to each side of the edges, in units. 3 by default (DefaultSettings.DefaultResizeAreaHalfWidth); negative values are taken as 0.

ResizeContourColor 🠆

Color · The color of the contour. (50, 50, 50, 190) by default (DefaultSettings.DefaultResizeContourColor); it fades and darkens with the element.

ResizeWithElementContour 🠆

bool · Shows a contour while dragging and resizes the element once on release, instead of resizing it as the mouse moves.

TexturesPath 🠆

string · A content folder with the element’s textures, for example UITextures/Button/. A missing trailing path separator is added.

TimeBeforeRepeatStartsMs 🠆

int · Milliseconds from the press to the first repeated click. 1000 by default; negative values are taken as 0.

TimeBetweenRepeatsMs 🠆

int · Milliseconds between the repeated clicks after the first one. 300 by default; negative values are taken as 0.

Transparency 🠆

float · From 0 (opaque, the default) to 1 (invisible); values outside are clamped. Applies to the element and its subtree, combined with the parents’ transparency.

VerticalAlignment 🠆

VerticalAlignment · Where the element sits in its slot vertically, and whether it stretches over it. The default is Stretch.

Visibility 🠆

Visibility · Whether the element is shown, hidden in its space or collapsed. The default is Visible. A hidden element loses the keyboard focus and any mouse state.

ZIndex 🠆

int · The element’s place among its overlapping siblings: a higher one is drawn above them and gets the mouse first, a lower one (it can be negative) goes below. The default is 0; siblings with the same one keep the order they were added in.

Methods

Clone() 🠆

Clone() · Returns a copy (as object) with the same properties assigned. Part styles in it are copied too.

IsSet() 🠆

IsSet(string propertyName) · Whether the property is assigned to this style, so the style applies it. Pass the name with nameof; an unknown name gives false.

Parameter Type Description
propertyName string The name of a property of the style; nameof keeps it right.

Unset() 🠆

Unset(string propertyName) · Takes the property back out of the style: the style stops applying it, it reads its type’s default again, and the elements using the style update.

Parameter Type Description
propertyName string The name of a property of the style; nameof keeps it right.