New to Telerik UI for WinFormsStart a free 30-day trial

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

Constructors

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

C#
public RadOpenFileDialog()

Properties

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.

C#
public string DefaultExt { get; set; }

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.

C#
public bool DereferenceLinks { get; set; }

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.

C#
public EditingOptions EditingOptions { get; set; }

FileNames

IEnumerable<string>

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.

C#
public IEnumerable<string> FileNames { get; }

Implements: IMultiFilesSelectable.FileNames

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 (.)|."

C#
public string Filter { get; set; }

Implements: IFileExtensionFilterable.Filter

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.

C#
public int FilterIndex { get; set; }

Implements: IFileExtensionFilterable.FilterIndex

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.

C#
public bool MultiSelect { get; set; }

Implements: IMultiSelectable.MultiSelect

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.

C#
public RadOpenFileDialogForm OpenFileDialogForm { get; }

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.

C#
public OpenFileDialogViewModel OpenFileDialogViewModel { get; }

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.

C#
public bool ReadOnlyChecked { get; set; }

SafeFileNames

IEnumerable<string>

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.

C#
public IEnumerable<string> SafeFileNames { get; }

Implements: IMultiFilesSelectable.SafeFileNames

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.

C#
public bool ShowReadOnly { get; set; }

Methods

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.

C#
protected override FileDialogFormBase CreateFileDialogForm()
Returns:

FileDialogFormBase

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

Overrides: FileDialogComponentBase.CreateFileDialogForm()

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.

C#
[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.