Input Validation Overview
- 2 minutes to read
Data Validation Basics
Data Validation takes place when a value specified by an end-user (e.g. a user types within a text editor and presses the ENTER key), is to be assigned to the editor’s BaseEdit.EditValue property. If the new value is invalid, it isn’t accepted by the editor. The editor temporarily stores the invalid value, until it is corrected or reset.
There are two validation types: automatic and manual. Automatic validation controls user input using the mask functionality. Manual validation should be implemented within the BaseEdit.Validate event handler. To learn more, see Input Validation Types.
Tip
If your form contains multiple standalone editors, it is possible to check that all of them are valid using the ValidationService class
Note
You can enable the input validation only for the BaseEdit class descendants.
Data Validation Features
With the new data validation system available in Data Editors, you can introduce the following features to your WPF application:
- Specify when data validation should take place: with each text modification operation, on an Enter key press or when trying to move focus away from the editor (see BaseEdit.ValidateOnTextInput, BaseEdit.ValidateOnEnterKeyPressed).
- Optionally block focus transition to other controls until a valid value is entered (see BaseEdit.InvalidValueBehavior).
- Reset invalid values by pressing the ESC key or using the BaseEdit.ClearError method.
- Automatically display an animated error icon and corresponding tooltip showing the error message.