Table of Contents

Class FileListBox

Namespace
Alternet.UI
Assembly
Alternet.UI.Common.dll

VirtualListBox descendant which allows to browse folder contents.

public class FileListBox : VirtualTreeControl, IBaseObjectWithAttr, IBaseObjectWithId, INotifyPropertyChanged, IDisposableObject, IBaseObject, ISupportInitialize, IFocusable, ITextProperty, IComponent, IControl, IDisposable, IWin32Window, INotifyDataErrorInfo, ITreeControlItemContainer
Inheritance
FileListBox
Implements

Constructors

FileListBox()

Initializes a new instance of the FileListBox class.

FileListBox(Control)

Initializes a new instance of the FileListBox class.

Fields

AddDrivesToRootFolder

Gets or sets whether to add all drives (c:, d:, etc.) to the list of the special folders.

AdditionalSpecialFolders

Gets or sets list of additional special folders. If specified, these folders will be added to the list of root level folders.

DefaultFileImage

Gets or sets default svg image used for the "file" items.

DefaultFolderImage

Gets or sets default svg image used for the "folder" items.

DriveItemTemplate

Gets or sets template for the drive item when it is added to the list of the special folders. Default is "{0}".

FileImageColorOverride

Gets or sets a function that provides a color override for file icons. This function returns a LightDarkColor object, which specifies the color to be used for file icons in light and dark themes.

FolderImageColorOverride

Gets or sets a function that provides a color override for folder icons. This function returns a LightDarkColor object, which specifies the color to be used for file icons in light and dark themes.

FolderInfo

Gets or sets global FileListBox.FolderInfoItem for the file or folder. FileListBox.FolderInfoItem allows to specify icon, custom title and some other information.

HiddenSpecialFolders

Gets or sets list of special folder which are hidden.

UseSolidFileDefaultImages

Gets or sets a value indicating whether to use solid default images for file items when DefaultFileImage not specified.

UseSolidFolderDefaultImages

Gets or sets a value indicating whether to use solid default images for folder items when DefaultFolderImage not specified.

VisibleSpecialFolders

Gets or sets list of visible special folders. If specified, only these folders will be visible on the root level.

Properties

AddRootFolderItem

Gets or sets whether to add "/" item which allows to open root folder.

AddUpperFolderItem

Gets or sets whether to add ".." item which allows to open parent folder.

AllowGoToSubFolder

Gets or sets whether double click on folder opens its content in the control.

IsReloading

Gets whether control is reloading and selection change events should be ignored.

SearchPattern

Gets or sets search pattern which allows to limit files shown in the control. An example: ".uixml". Default value is "" (all files).

SelectedFolder

Gets or sets folder which is currently opened in the control.

SelectedItem

Gets or sets item which is currently selected.

SelectedItemIsFile

Gets whether selected item is file.

SelectedItemPath

Gets path of the selected item. When this property is changed, selected item is updated to the item with the specified path.

Sorted

Gets or sets whether folder and file names are sorted.

Methods

AddFile(NewItemInfo)

Adds file to the control.

AddFile(string?, string, SvgImage?)

Adds file to the control.

AddFolder(NewItemInfo)

Adds folder to the control.

AddFolder(string?, string, SvgImage?)

Adds folder to the control.

AddSpecialFolder(SpecialFolder, string?)

Adds special folder specified using Environment.SpecialFolder enumeration.

AddSpecialFolders()

Adds all special folders to the control. VisibleSpecialFolders and HiddenSpecialFolders can be used to specify what folders are added.

GetFileImage()

Gets the default SVG image used for file items. If DefaultFileImage is not set, a known default file icon is returned.

GetFolderImage()

Gets the default SVG image used for folder items. If DefaultFolderImage is not set, a known default folder icon is returned.

ItemIsFile(FileListBoxItem?)

Gets whether item is file.

ItemIsFolder(FileListBoxItem?)

Gets whether item is folder.

NavigateToParentFolder()

Navigates to the parent folder. If the parent folder is the same as the current folder, it navigates to the root folder. If an exception occurs, it logs the exception and resets the selected folder to null. This method is called when parent folder item is double-clicked.

NavigateToRootFolder()

Navigates to the root folder. By default, this method sets the SelectedFolder property to null, effectively navigating to the root folder. This method is called when root folder item is double-clicked.

OnKeyDown(KeyEventArgs)

Called when the KeyDown event is raised.

Reload()

Reloads contents of the currently opened folder.

SelectFolderByFileName(string?)

Selects a folder by file name or folder path.

Events

AddRootFolder

Occurs when root folder items are added to the control. This event is called when SelectedFolder is assigned with null value.

SelectedFolderChanged

Occurs when the SelectedFolder property value changes. This event is raised after the folder selection has been updated.