Table of Contents

Interface IControlBuilder<TBuilder>

Namespace
BSGameLib.UI.Builder
Assembly
BSGameLib.UI.dll

The attributes every control and layout shares, from Control in view.xsd. Each takes the same values the XML attribute does: a literal, a "{Resource id}" or "{Localize key}" where the attribute reads one, or a "{Binding X}" through the Bind method where the XML accepts one.

public interface IControlBuilder<out TBuilder>

Type Parameters

TBuilder

Methods

BindDisabled(string)

Binds the Disabled attribute, which is true while the control is disabled, so the view model property should be too.

TBuilder BindDisabled(string propertyName)

Parameters

propertyName string

Returns

TBuilder

BindHoverKey(string)

Binds the hover text to the view model property propertyName.

TBuilder BindHoverKey(string propertyName)

Parameters

propertyName string

Returns

TBuilder

BindVisibility(string)

Binds visibility to the view model property propertyName, so the control shows and hides as it changes.

TBuilder BindVisibility(string propertyName)

Parameters

propertyName string

Returns

TBuilder

WithEnabledState(bool)

Sets whether the control is enabled. Written the way the XML Disabled attribute reads: see BindDisabled(string).

TBuilder WithEnabledState(bool isEnabled)

Parameters

isEnabled bool

Returns

TBuilder

WithHoverKey(string)

Text the game shows for this control when the pointer rests on it. See BindHoverKey(string).

TBuilder WithHoverKey(string hoverKey)

Parameters

hoverKey string

Returns

TBuilder

WithId(string)

Sets the control's id, which the game's code can use to find it.

TBuilder WithId(string id)

Parameters

id string

Returns

TBuilder

WithIsInitialFocus(bool)

Sets whether focus lands on this control when the view opens. The first such control that is visible and enabled wins.

TBuilder WithIsInitialFocus(bool isInitialFocus)

Parameters

isInitialFocus bool

Returns

TBuilder

WithMargin(Spacing)

Sets the space reserved around the control by its parent layout.

TBuilder WithMargin(Spacing spacing)

Parameters

spacing Spacing

Returns

TBuilder

WithMargin(int)

Sets the same margin on all four sides, in pixels.

TBuilder WithMargin(int margin)

Parameters

margin int

Returns

TBuilder

WithMargin(int, int)

Sets the horizontal and vertical margins, in pixels.

TBuilder WithMargin(int horizontalMargin, int verticalMargin)

Parameters

horizontalMargin int
verticalMargin int

Returns

TBuilder

WithMargin(int, int, int, int)

Sets the left, top, right and bottom margins, in pixels.

TBuilder WithMargin(int leftMargin, int topMargin, int rightMargin, int bottomMargin)

Parameters

leftMargin int
topMargin int
rightMargin int
bottomMargin int

Returns

TBuilder

WithPanelTitle(bool)

Sets whether this control is the title a panel is dragged by. Ignored outside a panel.

TBuilder WithPanelTitle(bool isPanelTitle)

Parameters

isPanelTitle bool

Returns

TBuilder

WithPosition(int, int)

Sets the control's position in pixels, as the Position attribute does.

TBuilder WithPosition(int x, int y)

Parameters

x int
y int

Returns

TBuilder

WithStyle(string)

The name of a style in the view's resources. The control's own settings win over it.

TBuilder WithStyle(string styleId)

Parameters

styleId string

Returns

TBuilder

WithVisibility(bool)

Sets whether the control is visible, as the Visible attribute does.

TBuilder WithVisibility(bool isVisible)

Parameters

isVisible bool

Returns

TBuilder