Skip to main content

EditBase.HasError Property

Allows you to switch the editor to an error state.

Namespace: DevExpress.XamarinForms.Editors

Assembly: DevExpress.XamarinForms.Editors.dll

NuGet Package: DevExpress.XamarinForms.Editors

Declaration

public bool HasError { get; set; }

Property Value

Type Description
Boolean

True, to enable the error state; otherwise, false.

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;
}
See Also