EditBase.ErrorText Property
Gets or sets the text message that appears below the editor in an error state. This is a bindable property.
Namespace: DevExpress.Maui.Editors
Assembly: DevExpress.Maui.Editors.dll
NuGet Package: DevExpress.Maui.Editors
Declaration
public string ErrorText { get; set; }
Property Value
Type | Description |
---|---|
String | The error message. |
Remarks
You can display the following text below an editor:
- HelpText - A brief editor description.
ErrorText
- A message shown when an error occurs (HasError istrue
).
If HelpText is not set, ErrorText appears as an additional line below the edit box and page content shifts down. To prevent this behavior, set the ReserveBottomTextLine property to true
.
Use the ErrorColor property to set the color of ErrorText, ErrorIcon, the editor’s label, and the edit box border. You can also use the ErrorIconColor property to specify an individual color for the error icon.
The following properties allow you to customize the font settings, and the help/error text position:
Property | Description |
---|---|
BottomTextFontAttributes | Configure the font settings for text displayed below the editor. |
Sets the distance between the editor’s help or error text and its bottom border. |
Example
This example shows how to validate the text input and customize the appearance of an error message:
<dxe:TextEdit x:Name="Login"
BottomTextFontAttributes="Italic"
BottomTextFontSize="14"
BottomTextTopIndent="8"
ErrorColor="Brown"
ErrorText="Login cannot be empty"
ReserveBottomTextLine="True"/>
<dx:DXButton Content="Submit"
Pressed="Button_Pressed"/>
private void Button_Pressed(object sender, EventArgs e){
if (string.IsNullOrEmpty(Login.Text))
Login.HasError = true;
else
Login.HasError = false;
}