You can use data validation to control the type of data and values that users are allowed to enter in a cell. This can be useful if you only want to allow correct values in a cell based on your data. Spread WPF supports data validation. Create validators to validate the user data. You can display a list of valid values for the user and display an invalid data image if the user types invalid data. You can use any of several types of validator methods to create the validation criteria.
- CreateDateValidator Method
- CreateFormulaListValidator Method
- CreateNumberValidator Method
- CreateTextLengthValidator Method
- CreateFormulaValidator Method
- CreateListValidator Method
Set the HighlightInvalidData property to use the red ellipse as an invalid data image. You can also customize the invalid data image with the InvalidDataPresenter control. The following code uses different types of validators to validate the data in B1, B2, and B3. Validators C#
VB
The following code customizes the invalid data image. The following image illustrates a valid value for the cell. Valid Value The following image illustrates an invalid value.
Invalid Value XAML <Window.Resources> </Window.Resources> C#
VB
This example validates a date with the CreateDateValidator method. Date Validator C#
VB
This example uses a validator to check that the integer value is greater than 0. Formula Validator C#
VB