Unlike the DxValidationProvider, the DxValidateColumnProvider must be instantiated programmatically.
private DxValidateColumnProvider validateColumn;
...
validateColumn = new DxValidateColumnProvider(true, gridView);
In this example a new DxValidateColumnProvider is instantiated. The first parameter tells the provider to run each of the individual column validators immediately before the row loses focus. The second parameter is a view to register with the provider. Multiple views can be passed to the constructor.
Views can also be added outside of the constructor.
validateColumn.AddView(layoutView);
Next, rules are added to validate columns. This is done by calling the provider's SetValidationRule method. The data field name associated with the column, the implementation of IColumnValidator, and finally, which managed views this rule is associated with. If you want all views to be covered by this rule don't pass any views to the method.
// set a custom validation rule on the 'Name' column which
// ensures that even trimmed strings must not be blank.
validateColumn.SetValidationRule("Name",
new NotBlankTrimmedColumnValidationRule());
int minAge = 18;
// use a ConditionColumnValidator to ensure that
// the person is of age.
validateColumn.SetValidationRule("Age",
new ConditionColumnValidator(String.Format(
"Age must be greater than {0}.", minAge),
ConditionOperator.Greater, minAge), gridView, layoutView);
// use a CompareAgainstColumnValueValidator to ensure
// that the 'Name' and 'Code' columns are not the same.
validateColumn.SetValidationRule("Code",
new CompareAgainstColumnValueValidator("Name",
CompareControlOperator.NotEquals,
"Code must be different then Name."));
Finally, you may want to validate a number of columns for consistency. This can be done by assigning a rule to the RowValidator property. This rule will run just prior to the row losing focus.
validateColumn.RowValidator = new RowValidationRule();
To see how to create a custom validation rule see Creating Custom Validation Rules