Show / Hide Table of Contents

Class OpenFileDialog

Provides a dialog box that enables the user to select one or more files.

Inheritance
System.Object
OpenFileDialog
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: OpenSilver.Controls
Assembly: OpenSilver.dll
Syntax
public sealed class OpenFileDialog

Constructors

| Improve this Doc View Source

OpenFileDialog()

Initializes a new instance of the OpenFileDialog class.

Declaration
public OpenFileDialog()

Properties

| Improve this Doc View Source

File

Gets a MemoryFileInfo object for the selected file. If multiple files are selected, returns the first selected file.

Declaration
public MemoryFileInfo File { get; }
Property Value
Type Description
MemoryFileInfo

The selected file. If multiple files are selected, returns the first selected file.

| Improve this Doc View Source

Files

Gets a collection of MemoryFileInfo objects for the selected files.

Declaration
public IEnumerable<MemoryFileInfo> Files { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<MemoryFileInfo>
| Improve this Doc View Source

Filter

Gets or sets a filter string that specifies the file types and descriptions to display in the OpenFileDialog.

Declaration
public string Filter { get; set; }
Property Value
Type Description
System.String

A filter string that specifies the file types and descriptions to display in the OpenFileDialog. The default is System.String.Empty.

| Improve this Doc View Source

Multiselect

Gets or sets a value that indicates whether the OpenFileDialog allows users to select multiple files.

Declaration
public bool Multiselect { get; set; }
Property Value
Type Description
System.Boolean

true if multiple selections are allowed; otherwise, false. The default is false.

Methods

| Improve this Doc View Source

ShowDialogAsync()

Opens the default browser file dialog. This returns a Task, differently from Silverlight. This is because it is not possible to wait for the dialog to conclude, since the process is single-threaded.

Declaration
public Task<bool?> ShowDialogAsync()
Returns
Type Description
System.Threading.Tasks.Task<System.Nullable<System.Boolean>>

A Task that will have the result of the file dialog. True for files selected, false for cancel/exit.

| Improve this Doc View Source

ShowDialogAsync(Window)

Opens the default browser file dialog. This returns a Task, differently from Silverlight. This is because it is not possible to wait for the dialog to conclude, since the process is single-threaded.

Declaration
public Task<bool?> ShowDialogAsync(Window owner)
Parameters
Type Name Description
Window owner
Returns
Type Description
System.Threading.Tasks.Task<System.Nullable<System.Boolean>>

A Task that will have the result of the file dialog. True for files selected, false for cancel/exit.

  • Improve this Doc
  • View Source