Represents data validation associated with a range of cells.
Namespace: MindFusion.Spreadsheet.Wpf
Assembly: MindFusion.Spreadsheet.Wpf
C# Copy Code |
---|
public interface IValidation |
Visual Basic Copy Code |
---|
Public Interface IValidation |
This interface is used to validate user input in a cell or range of cells. There are several types of validations that can be used, as specified by the Type property.
To display a popup message when a cell associated with the validation is selected, set the ShowInputMessage property to true and customize the input message through the InputTitle and InputMessage properties. The ErrorAction property determines what happens when the validation fails. The control can display a warning, an error message, or simply raise an event.
The different validation types and their required operands are discussed in more details below.
This validation type indicates that the validation will always be successful and is effectively the same as no validation.
The validation compares the input value to the values specified by First and Second using the operator specified by Operator. The input value should be numeric and the operands should be convertible to numbers. In the WholeNumber case, the input value should also be a whole number. The following table illustrates the valid operators for this validation type and how the two operands are used by each operator.
Operator | Validation |
---|---|
The input value must be greater than or equal to First and less than or equal to Second. | |
The input value must be less than First or greater than Second. | |
The input value must be equal / not equal to First. Second is not used. | |
The input value must be less than / less than or equal to First. Second is not used. | |
The input value must be greater than / greater than or equal to Second. First is not used. |
The validation compares the input to the value specified by First using the operator specified by Operator. Second is not used. The operand should be convertible to a string. The following table illustrates the valid operators for this validation type.
Operator | Validation |
---|---|
The input value must contain / not contain First. | |
The input value must be equal / not equal to First. |
The validation compares the length of the input to the value specified by First and Second using the operator specified by Operator, following rules similar to those used when validating numeric values (see above).
The validation compares the input value to a list of values obtained from First. First can be a string, containing a comma-delimited list of values. Alternatively, First can be an expression that evaluates to a string with comma-delimited values, or to a cell reference. In the later case the list is composed of the values of all cells in the referenced range.