Interface IControlBuilder<TBuilder>
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
propertyNamestring
Returns
- TBuilder
BindHoverKey(string)
Binds the hover text to the view model property propertyName.
TBuilder BindHoverKey(string propertyName)
Parameters
propertyNamestring
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
propertyNamestring
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
isEnabledbool
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
hoverKeystring
Returns
- TBuilder
WithId(string)
Sets the control's id, which the game's code can use to find it.
TBuilder WithId(string id)
Parameters
idstring
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
isInitialFocusbool
Returns
- TBuilder
WithMargin(Spacing)
Sets the space reserved around the control by its parent layout.
TBuilder WithMargin(Spacing spacing)
Parameters
spacingSpacing
Returns
- TBuilder
WithMargin(int)
Sets the same margin on all four sides, in pixels.
TBuilder WithMargin(int margin)
Parameters
marginint
Returns
- TBuilder
WithMargin(int, int)
Sets the horizontal and vertical margins, in pixels.
TBuilder WithMargin(int horizontalMargin, int verticalMargin)
Parameters
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
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
isPanelTitlebool
Returns
- TBuilder
WithPosition(int, int)
Sets the control's position in pixels, as the Position attribute does.
TBuilder WithPosition(int x, int y)
Parameters
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
styleIdstring
Returns
- TBuilder
WithVisibility(bool)
Sets whether the control is visible, as the Visible attribute does.
TBuilder WithVisibility(bool isVisible)
Parameters
isVisiblebool
Returns
- TBuilder