Class
RadOpenFileDialog

Represents a Telerik-themed open file dialog control that allows users to browse and select files from the file system. This control provides advanced functionality including multi-file selection, filtering, and custom theming while maintaining compatibility with standard Windows file dialogs.

Definition

Namespace:Telerik.WinControls.UI

Assembly:Telerik.WinControls.UI.dll

Syntax:

cs-api-definition
public class RadOpenFileDialog : FileDialogComponentBase, IComponent, IDisposable, IMultiSelectable, IMultiFilesSelectable, IFileExtensionFilterable

Inheritance: objectMarshalByRefObjectComponentFileDialogComponentBaseRadOpenFileDialog

Implements: IComponentIDisposableIFileExtensionFilterableIMultiFilesSelectableIMultiSelectable

Inherited Members FileDialogComponentBase.ShowDialog()FileDialogComponentBase.ShowDialog(IWin32Window)FileDialogComponentBase.OpenFileInternal(FileMode, FileAccess)FileDialogComponentBase.DialogFormFileDialogComponentBase.FileNameFileDialogComponentBase.ShowNetworkLocationsFileDialogComponentBase.InitialDirectoryFileDialogComponentBase.RestoreDirectoryFileDialogComponentBase.CustomPlacesFileDialogComponentBase.ExpandToCurrentDirectoryFileDialogComponentBase.ShowHiddenFilesFileDialogComponentBase.InitialSelectedLayoutFileDialogComponentBase.DirectoryRequestingFileDialogComponentBase.DirectoryNavigatingFileDialogComponentBase.ShellContextMenuOpeningFileDialogComponentBase.ExceptionRaisedComponent.Dispose()Component.Dispose(bool)Component.GetService(Type)Component.ToString()Component.CanRaiseEventsComponent.EventsComponent.SiteComponent.ContainerComponent.DesignModeComponent.DisposedMarshalByRefObject.MemberwiseClone(bool)MarshalByRefObject.GetLifetimeService()MarshalByRefObject.InitializeLifetimeService()MarshalByRefObject.CreateObjRef(Type)

Constructors

RadOpenFileDialog()

Initializes a new instance of the RadOpenFileDialog class. Creates the underlying dialog form and prepares the control for use.

Declaration

cs-api-definition
public RadOpenFileDialog()

Properties

DefaultExt

Gets or sets the default file extension that will be appended to file names when no extension is specified. The extension should include the leading period (e.g., ".txt"). If set to null or empty, no default extension is applied.

Declaration

cs-api-definition
public string DefaultExt { get; set; }

Property Value

string

Implements IFileExtensionFilterable.DefaultExt

Gets or sets a value indicating whether the dialog resolves shortcut links to their target files. When true, selecting a shortcut (.lnk) file returns the path to the target file. When false, selecting a shortcut returns the path to the shortcut file itself.

Declaration

cs-api-definition
public bool DereferenceLinks { get; set; }

Property Value

bool

EditingOptions

Gets or sets the editing options that determine how files and folders in the ExplorerControl can be modified. This property controls user operations such as renaming, deleting, and creating new items within the dialog. Note that shell context menu and drag-and-drop operations are handled separately from these settings.

Declaration

cs-api-definition
public EditingOptions EditingOptions { get; set; }

Property Value

EditingOptions

FileNames

Gets a collection of full file paths for all files selected by the user. When MultiSelect is false, this collection contains at most one item. When MultiSelect is true, this collection contains all selected file paths.

Declaration

cs-api-definition
public IEnumerable<string> FileNames { get; }

Property Value

IEnumerable<string>

Implements IMultiFilesSelectable.FileNames

Filter

Gets or sets the file name filter string that determines which files are displayed in the dialog. The filter string contains filter pairs separated by the pipe character, where each pair consists of a description and pattern. For example: "Text files (.txt)|.txt|All files (.)|."

Declaration

cs-api-definition
public string Filter { get; set; }

Property Value

string

Implements IFileExtensionFilterable.Filter

FilterIndex

Gets or sets the index of the currently selected filter in the file type drop-down list. The index is one-based, where 1 corresponds to the first filter in the Filter string. Setting this to 0 or an invalid index will select the first available filter.

Declaration

cs-api-definition
public int FilterIndex { get; set; }

Property Value

int

Implements IFileExtensionFilterable.FilterIndex

MultiSelect

Gets or sets a value indicating whether multiple files can be selected simultaneously in the dialog. When enabled, users can select multiple files using Ctrl+click or Shift+click, and the selected files can be accessed through FileNames.

Declaration

cs-api-definition
public bool MultiSelect { get; set; }

Property Value

bool

Implements IMultiSelectable.MultiSelect

OpenFileDialogForm

Gets the underlying RadOpenFileDialogForm that provides the user interface and core functionality for the open file dialog. This property provides access to form-specific properties and methods that are not exposed at the component level.

Declaration

cs-api-definition
public RadOpenFileDialogForm OpenFileDialogForm { get; }

Property Value

RadOpenFileDialogForm

OpenFileDialogViewModel

Gets the view model that manages the data and business logic for the open file dialog. The view model provides access to the underlying data structure and state management for the dialog.

Declaration

cs-api-definition
public OpenFileDialogViewModel OpenFileDialogViewModel { get; }

Property Value

OpenFileDialogViewModel

ReadOnlyChecked

Gets or sets a value indicating whether the read-only checkbox in the dialog is currently checked. When checked, this typically indicates that the selected file should be opened in read-only mode. This property only has an effect when ShowReadOnly is set to true.

Declaration

cs-api-definition
public bool ReadOnlyChecked { get; set; }

Property Value

bool

SafeFileNames

Gets a collection of file names (without path information) for all files selected by the user. This property provides only the file names and extensions, excluding the directory path. The collection corresponds to the files in FileNames but contains only the file names.

Declaration

cs-api-definition
public IEnumerable<string> SafeFileNames { get; }

Property Value

IEnumerable<string>

Implements IMultiFilesSelectable.SafeFileNames

ShowReadOnly

Gets or sets a value indicating whether the dialog displays a read-only checkbox. When enabled, users can indicate their intention to open the selected file in read-only mode. The state of this checkbox can be accessed through the ReadOnlyChecked property.

Declaration

cs-api-definition
public bool ShowReadOnly { get; set; }

Property Value

bool

Methods

CreateFileDialogForm()

Creates and returns a new instance of the dialog form that provides the user interface for the open file dialog. This method is called during initialization to create the underlying form that handles user interaction.

Declaration

cs-api-definition
protected override FileDialogFormBase CreateFileDialogForm()

Returns

FileDialogFormBase

A new RadOpenFileDialogForm instance that serves as the dialog's user interface.

Overrides FileDialogComponentBase.CreateFileDialogForm()

OpenFile()

Opens a read-only stream for the file selected by the user in the dialog. This method provides convenient access to the selected file's content without requiring manual stream creation. The returned stream should be disposed of properly after use.

Declaration

cs-api-definition
[SecurityCritical]
public Stream OpenFile()

Returns

Stream

A new Stream that provides read-only access to the selected file's content.

Exceptions

ArgumentNullException

Selected file is null.

ArgumentException

Selected file is empty string, contains only white space, contains one or more invalid characters, or refers to a non-file device.

NotSupportedException

Selected file refers to a non-file device.

FileNotFoundException

Selected file cannot be found, such as when mode is FileMode.Truncate or FileMode.Open, and the file specified by path does not exist. The file must already exist in these modes.

IOException

An I/O error occurred or the stream has been closed.

SecurityException

The caller does not have the required permission.

DirectoryNotFoundException

Selected file is invalid, such as being on an unmapped drive.

UnauthorizedAccessException

The access requested is not permitted by the operating system for the specified path, such as when access is Write or ReadWrite and the file or directory is set for read-only access.

PathTooLongException

The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters.

ArgumentOutOfRangeException

The specified mode contains an invalid value.