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.
Inherited Members
Namespace: Telerik.WinControls.UI
Assembly: Telerik.WinControls.UI.dll
Syntax
public class RadOpenFileDialog : FileDialogComponentBase, IMultiSelectable, IMultiFilesSelectable, IFileExtensionFilterable
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
System.String
|
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.
Declaration
public bool DereferenceLinks { get; set; }
Property Value
System.Boolean
|
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
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
public IEnumerable<string> FileNames { get; }
Property Value
System.Collections.Generic.IEnumerable<System.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 (.)|."
Declaration
public string Filter { get; set; }
Property Value
System.String
|
Implements
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
public int FilterIndex { get; set; }
Property Value
System.Int32
|
Implements
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
public bool MultiSelect { get; set; }
Property Value
System.Boolean
|
Implements
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
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
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
public bool ReadOnlyChecked { get; set; }
Property Value
System.Boolean
|
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
System.Collections.Generic.IEnumerable<System.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.
Declaration
public bool ShowReadOnly { get; set; }
Property Value
System.Boolean
|
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
FileDialogFormBase
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
System.IO.Stream
A new System.IO.Stream that provides read-only access to the selected file's content. |
Exceptions
System.ArgumentNullException
Selected file is null. |
System.ArgumentException
Selected file is empty string, contains only white space, contains one or more invalid characters, or refers to a non-file device. |
System.NotSupportedException
Selected file refers to a non-file device. |
System.IO.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. |
System.IO.IOException
An I/O error occurred or the stream has been closed. |
System.Security.SecurityException
The caller does not have the required permission. |
System.IO.DirectoryNotFoundException
Selected file is invalid, such as being on an unmapped drive. |
System.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. |
System.IO.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. |
System.ArgumentOutOfRangeException
The specified mode contains an invalid value. |
Explicit Interface Implementations
IMultiSelectable.SelectedFileSystemInfoWrappers
This property is not relevant for this class.
Declaration
ObservableCollection<FileSystemInfoWrapper> IMultiSelectable.SelectedFileSystemInfoWrappers { get; }
Returns
System.Collections.ObjectModel.ObservableCollection<FileSystemInfoWrapper>
|