Class TextBoxAndLabel
Implements TextBox with attached label.
[ControlCategory("Editors")]
public class TextBoxAndLabel : ControlAndLabel<TextBox, Label>, IBaseObjectWithId, IDisposableObject, IBaseObject, ISupportInitialize, IFocusable, ITextProperty, IComponent, IControl, IDisposable, IWin32Window, IControlAndLabel, INotifyDataErrorInfo
- Inheritance
-
TextBoxAndLabel
- Implements
- Derived
Examples
Here is how to declare a TextBoxAndLabel in UIXML:
<TextBoxAndLabel Text="some value" Title="Short Label" Name="control1"
TextChanged="TextBoxTextChanged" Margin="10"/>
And the corresponding event handler in the code-behind:
public void TextBoxTextChanged(object? sender, EventArgs e)
{
App.Log($"TextBox {(sender as Control)?.Name} Text changed");
}
Also, a TextBoxAndLabel can be created from code:
TextBoxAndLabel control = new();
control.Margin = 10;
control.Text = "some value 2";
control.Title = "This is very long label";
control.Parent = mainPanel;
control.Name = "control2";
control.TextChanged += TextBoxTextChanged;
control.InnerSuggestedWidth = 200;
Remarks
Example of how a TextBoxAndLabel can look:
Constructors
- TextBoxAndLabel()
Initializes a new instance of the TextBoxAndLabel class.
- TextBoxAndLabel(Control)
Initializes a new instance of the TextBoxAndLabel class.
- TextBoxAndLabel(string, string?)
Initializes a new instance of the TextBoxAndLabel class.
Properties
- AutoShowError
Gets or sets whether error reporter is automatically shown/hidden when error state is changed.
- HasInnerBorder
Gets or sets whether main inner control has border.
- InputType
Gets or sets input type. Default is Null.
- InputTypeArgs
Gets or sets init arguments which are used when InputType property is assigned.
- IsNullOrEmpty
Gets whether Text is null or empty.
- IsNullOrWhiteSpace
Gets whether Text is null or white space.
- IsValidMail
Gets whether editor contains a valid e-mail address.
Methods
- Init()
Initializes main child control.
- MainControlTextChanged()
Called when text is changed in the main child control.