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

Open a RadOpenFileDialog when Using the RadCloudUpload

Environment

Product RadCloudUpload for WPF

Description

How to replace the default MS OpenFileDialog with a RadOpenFileDialog.

Solution

Handle the AddingFiles event of the RadCloudUpload control, cancel the creation of the default dialog with the CancelDialogOpening property, open a new RadOpenFileDialog and populate the FileNames collection with the files, selected in the dialog.

private void RadCloudUpload_AddingFiles(object sender, AddingFilesEventArgs e) 
{ 
    e.CancelDialogOpening = true; 
 
    if (fileDialog == null) 
    { 
        fileDialog = new RadOpenFileDialog(); 
        fileDialog.Multiselect = true; 
    } 
 
    if (fileDialog.ShowDialog() == true) 
    { 
        foreach (var file in fileDialog.FileNames) 
        { 
            e.FileNames.Add(file); 
        } 
    } 
}