Class OpenFileDialog
Provides a dialog box that enables the user to select one or more files.
Inheritance
Inherited Members
Namespace: OpenSilver.Controls
Assembly: OpenSilver.dll
Syntax
public sealed class OpenFileDialog
Constructors
| Improve this Doc View SourceOpenFileDialog()
Initializes a new instance of the OpenFileDialog class.
Declaration
public OpenFileDialog()
Properties
| Improve this Doc View SourceFile
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. |
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> |
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. |
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 SourceShowDialogAsync()
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. |
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. |