EditBase.ErrorText Property
Specifies the text message that appears below the editor in an error state.
Namespace: DevExpress.XamarinForms.Editors
Assembly: DevExpress.XamarinForms.Editors.dll
NuGet Package: DevExpress.XamarinForms.Editors
Declaration
public string ErrorText { get; set; }
Property Value
Type | Description |
---|---|
String | 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 is true).
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"/>
<dxe:SimpleButton Text="Submit"
Pressed="SimpleButton_Pressed"/>
private void SimpleButton_Pressed(object sender, EventArgs e){
if (string.IsNullOrEmpty(Login.Text))
Login.HasError = true;
else
Login.HasError = false;
}