So generally for all controls:
- Drag and drop DxValidationProvider onto your form.
- Click the provider.
- Set validation mode to manual.
- You will also be get a smart tag for "Customize Validation Rules"
- Select your control and setup the validation rules.
- When you want to validate (e.g. on OK button) use something like the following code:
if(dxValidationProvider1.GetInvalidControls().Count!=0)
return;
this.DialogResult = DialogResult.OK;
this.Close();
Done :)
Now for setting up a combobox with valid values as no values along with a list do the following:
- Select your combobox
- In its properties expand the properties section.
- set your selectables in its items collection (with a blank newline as the first line for the empty string)
- Delete its edit value
- Launch its validation editor (from DxValidationProvider).
- Set "Contition Validation" along with "Conditional Operator" as "AnyOf". Edit the values and paste the same items as you did in the items collection.
No comments:
Post a Comment