Class FormBuilder
Definition
Namespace: StardewUI.Widgets
Assembly: StardewUI.dll
Fluent builder style API for creating form-like tables within a view.
Inheritance
Object ⇦ FormBuilder
Remarks
Useful for "settings" style views.
Members
Constructors
Name | Description |
---|---|
FormBuilder(Int32, Int32) | Fluent builder style API for creating form-like tables within a view. |
Methods
Name | Description |
---|---|
AddCustom(IView) | Adds a custom row, which is simply a horizontal Lane consisting of the specified views, not including any label - i.e. the first view is flush with the labels on other rows. |
AddField(string, string, IView) | Adds a labeled control row, i.e. a field. |
AddSection(string) | Starts a new section by adding header text. |
Build() | Builds the form. |
CreateSectionHeading(string) | Creates the banner used as a section heading. |
SetMargin(Edges) | Configures the margin for the entire form. |
SetPadding(Edges) | Configures the padding for the entire form. |
Details
Constructors
FormBuilder(int, int)
Fluent builder style API for creating form-like tables within a view.
Parameters
labelWidth
Int32
The width of the label column. Same for all rows.
fieldIndent
Int32
Pixel amount by which to indent the field rows, relative to any heading rows.
Remarks
Useful for "settings" style views.
Methods
AddCustom(IView)
Adds a custom row, which is simply a horizontal Lane consisting of the specified views, not including any label - i.e. the first view is flush with the labels on other rows.
Parameters
views
IView
The views to display in this row.
Returns
The current builder instance.
Remarks
Might be used for a row of confirmation buttons, a paragraph of help text, etc.
AddField(string, string, IView)
Adds a labeled control row, i.e. a field.
public StardewUI.Widgets.FormBuilder AddField(string title, string description, StardewUI.IView view);
Parameters
title
string
The field title, displayed on the left side.
description
string
Description of the field's value or purpose, displayed as a tooltip when hovering over the title text.
view
IView
The view for modifying the field's value.
Returns
The current builder instance.
AddSection(string)
Starts a new section by adding header text.
Parameters
title
string
The section title.
Returns
The current builder instance.
Build()
Builds the form.
Returns
The view containing the form layout.
CreateSectionHeading(string)
Creates the banner used as a section heading.
Parameters
title
string
The section title.
Returns
Section heading view.
Remarks
This is the standalone version of AddSection(string) that can be used by any views wanting to provide form-style section headings outside of an actual form.
SetMargin(Edges)
Configures the margin for the entire form.
Parameters
margin
Edges
Margin outside the form.
Returns
The current builder instance.
SetPadding(Edges)
Configures the padding for the entire form.
Parameters
padding
Edges
Padding inside the form.
Returns
The current builder instance.