New to Telerik UI for WPF? Download free 30-day trial

Validation

The RadCloudUpload control allows you to validate the files that the end user has selected. For this purpose you can use the ValidationRules property. It is of type List<System.Windows.Controls.ValidationRule> and expects you to provide validation rules.

You can read the Create Custom Validation Rule help article.

The Validate() method of each rule will be executed providing the selected file's name. If there are no validation rules, or all rules return valid result - a valid item is created. In case there is at least one rule that returns an invalid result - an invalid item is created for this file.

Validation is executed once the user selects file(s). If later you add or remove validation rules, the files will not be reevaluated.

There is a built-in validation rule (CloudUploadFileSizeValidationRule) that can be used to validate the size of the files. Example 1 demonstrates how you can use the rule.

Example 1: Adding a validation rule

<telerik:RadCloudUpload> 
    <telerik:RadCloudUpload.ValidationRules> 
        <!--10MB limit--> 
        <telerik:CloudUploadFileSizeValidationRule MaxFileSize="10000000" /> 
    </telerik:RadCloudUpload.ValidationRules> 
 ... 
</telerik:RadCloudUpload> 

See Also

In this article