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); 
        } 
    } 
} 
Private Sub RadCloudUpload_AddingFiles(ByVal sender As Object, ByVal e As AddingFilesEventArgs) 
    e.CancelDialogOpening = True 
 
    If fileDialog Is Nothing Then 
        fileDialog = New RadOpenFileDialog() 
        fileDialog.Multiselect = True 
    End If 
 
    If fileDialog.ShowDialog() = True Then 
        For Each file In fileDialog.FileNames 
            e.FileNames.Add(file) 
        Next file 
    End If 
End Sub 

See Also

In this article
Not finding the help you need? Improve this article