Table of Contents

Class FileDialog

Namespace
Terminal.Gui
Assembly
Terminal.Gui.dll

Modal dialog for selecting files/directories. Has auto-complete and expandable navigation pane (Recent, Root drives etc).

public class FileDialog : Dialog, IDisposable, ISupportInitializeNotification, ISupportInitialize, IDesignable
Inheritance
FileDialog
Implements
Derived
Inherited Members

Constructors

FileDialog()

Initializes a new instance of the FileDialog class.

Properties

AllowedTypes

Gets or Sets a collection of file types that the user can/must select. Only applies when OpenMode is File or Mixed.

AllowsMultipleSelection

Gets or Sets a value indicating whether to allow selecting multiple existing files/directories. Defaults to false.

CurrentFilter

The UI selected IAllowedType from combo box. May be null.

FileOperationsHandler

Gets or sets behavior of the FileDialog when the user attempts to delete a selected file(s). Set to null to prevent deleting.

MaxSearchResults

The maximum number of results that will be collected when searching before stopping.

MultiSelected

Gets all files/directories selected or an empty collection AllowsMultipleSelection is false or Terminal.Gui.FileDialog.CancelSearch().

MustExist

True if the file/folder must exist already to be selected. This prevents user from entering the name of something that doesn't exist. Defaults to false.

OpenMode

Gets or Sets which FileSystemInfo type can be selected. Defaults to Mixed (i.e. DirectoryInfo or FileInfo).

Path

Gets or Sets the selected path in the dialog. This is the result that should be used if AllowsMultipleSelection is off and Terminal.Gui.FileDialog.CancelSearch() is true.

SearchMatcher

Defines how the dialog matches files/folders when using the search box. Provide a custom implementation if you want to tailor how matching is performed.

Style

Gets settings for controlling how visual elements behave. Style changes should be made before the Dialog is loaded and shown to the user for the first time.

Methods

Dispose(bool)

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

GetDefaultTitle()

Gets a default dialog title, when Title is not set or empty, result of the function will be shown.

IsCompatibleWithAllowedExtensions(IFileInfo)

Returns true if there are no AllowedTypes or one of them agrees that fileIsAllowed(string).

OnDrawingContent()

Called when the View's content is to be drawn. The default implementation does nothing.

OnLoaded()

Called from Begin(Toplevel) before the Toplevel redraws for the first time.

Events

FilesSelected

Event fired when user attempts to confirm a selection (or multi selection). Allows you to cancel the selection or undertake alternative behavior e.g. open a dialog "File already exists, Overwrite? yes/no".