ClassRadOpenFileDialog
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:
public class RadOpenFileDialog : FileDialogComponentBase, IComponent, IDisposable, IMultiSelectable, IMultiFilesSelectable, IFileExtensionFilterable
Inheritance: objectMarshalByRefObjectComponentFileDialogComponentBaseRadOpenFileDialog
Implements:
Inherited Members
Constructors
RadOpenFileDialog()
Initializes a new instance of the RadOpenFileDialog class. Creates the underlying dialog form and prepares the control for use.
Declaration
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
public string DefaultExt { get; set; }
Property Value
Implements
DereferenceLinks
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.
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
public EditingOptions EditingOptions { get; set; }
Property Value
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
public IEnumerable<string> FileNames { get; }
Property Value
IEnumerable<string>
Implements
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 (.)|."
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.
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.
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
public RadOpenFileDialogForm OpenFileDialogForm { get; }
Property Value
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
public OpenFileDialogViewModel OpenFileDialogViewModel { get; }
Property Value
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.
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
public IEnumerable<string> SafeFileNames { get; }
Property Value
IEnumerable<string>
Implements
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.
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
protected override FileDialogFormBase CreateFileDialogForm()
Returns
A new RadOpenFileDialogForm instance that serves as the dialog's user interface.
Overrides
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
[SecurityCritical]
public Stream OpenFile()
Returns
A new Stream that provides read-only access to the selected file's content.
Exceptions
Selected file is null.
Selected file is empty string, contains only white space, contains one or more invalid characters, or refers to a non-file device.
Selected file refers to a non-file device.
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.
An I/O error occurred or the stream has been closed.
The caller does not have the required permission.
Selected file is invalid, such as being on an unmapped drive.
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.
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.
The specified mode contains an invalid value.