Events

This article lists the events specific to all of the RadFileDialog controls.

  • PreviewClosed: This event occurs when the dialog is closing. The event arguments are of type WindowPreviewClosedEventArgs. You can use the arguments to cancel the event.

    Example 1: Cancel dialog closing

        private void FileDialog_PreviewClosed(object sender, WindowPreviewClosedEventArgs e) 
        { 
            e.Cancel = true; 
        } 
    
  • Closed: This event occurs when the dialog is closed. The event arguments are of type WindowClosedEventArgs.

  • ExceptionRaised: This event occurs when an exception is raised. This event could be raised in different occasions, for example - if the selected folder cannot be accessed or if the file path is too long, or when there is an error while searching, etc.

    Example 2: Showing an alert when an error appears

        private void openDialog_ExceptionRaised(object sender, FileBrowserExceptionRaisedEventArgs e) 
        { 
            MessageBox.Show(e.Exception.Message); 
        } 
    
  • DirectoryRequesting: This event can be used to filter the navigation RadTreeView and RadBreadcrumb or any Custom Places that are added. The following example demonstrates how you can filter out the "D:\" and "K:\" directories:

    Example 3: Filtering the D and K directories

        private void OpenFileDialog_DirectoryRequesting(object sender, Telerik.Windows.Controls.FileDialogs.DirectoryRequestingEventArgs e) 
        { 
            if (e.Directory.FullName.StartsWith("D:\") || e.Directory.FullName.StartsWith("K:\")) 
            { 
                e.Cancel = true; 
            } 
        } 
    

    If the InitialDirectory of the RadFileDialog is filtered out as in Example 3, the current directory on load will be the default one.

    Image 1: Unfiltered Directories

    Image 2: Filtered Directories Based on Example 3

See Also

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