File System UI Product Tour
Introduction
The Blayd File System UI library contains components and controls that provide a
user interface representation of file system devices, folders and files. The library
is designed to make it easy for developers to display file system information when
creating Windows Forms user interfaces for applications such as file backup and
archive, file explorers and custom file open or save as dialogs. Developers can
use the components and controls in their applications to easily display file system
information to the user. The data source components, when data bound to the user
interface controls, provide the developer with a significant level of functionality
within the designer and a lot can be achieved without writing any code.
Specification
Blayd File System UI is a component and control library for Windows Forms. The component
targets the .Net Framework version 2.0 but is supported on versions 3.0 and 3.5.
The Blayd File System UI library is run time royalty free so developers using one
or more of the components or controls in the library can ship the library with their
application without charge. A developer license is required to use the Blayd File
System UI library at design time but the library can be evaluated free of charge
for a period of 14 days. Whilst in evaluation mode the Blayd File System UI library
is fully functional, however, the library will only operate from within the development
environment.
Controls
FileListView
The FileListView control is a specialised extension of the standard ListView control
that fully integrates, through data binding, with the FileList (see below) data
source component.
FileListView Control in Details view
The FileListView control lists and displays the file system objects
contained in a single file system folder. The list may contain the file system objects
of the "virtual" Computer (My Computer on Windows XP) folder, in which
case the list will contain disk drives or the list may contain the file system objects
of a conventional folder, in which case the list will contain sub-folders and/or
files. The FileListView control fully integrates, through data binding,
with the FileList (see below) data source component. The FileListView
control provides a DataSource property to enable developers to
data bind the control to the FileList component.
Some of the key features of the FileListView control are listed below:
- Data Binding
-
The
FileListView control may be data bound to the FileList data source component
to provide the automatic management and display of the file system item data provided
by the FileList component.
When data binding to the FileList data source component, developers can use the
same image lists for the FileListView control and the FileList component and specify
the image key of the "stock" drive and folder images so that the FileList component
initializes each of the file system drive and sub-folder items to use the relevant
image.
When data binding to the FileList data source component and using the same image
lists for the FileListView control and the FileList data source component,
the FileList component will populate the image lists with the image associated with each file
type that it loads. Each associated file type image is assigned the relevant file
extension as its key e.g. the text file type will have a key value of ".txt". The
FileListView control will use the file type images specified by the FileList data
source component for each of the file items that it displays.
- Linking to Other Controls
-
The
FileListView control can be linked to and synchronized with other user interface
controls, such as the FolderDropDownList or the FolderTreeView, using the linking
capabilities of the FileList data source component.
To link the FileListView control to another control developers can data bind the
FileListView control to the FileList data source and then link the FileList data
source to the FolderList data source component. The FolderList data source component
can then be data bound to either the FolderDropDownList or the FolderTreeView control.
- Displays Drives, Sub-folders and Files
-
The
FileListView control provides its own "item views" to accommodate the display
of drive items from the Computer "virtual" folder and sub-folders and/or files from
conventional folders. The DriveItems view is used to display drives and the FileFolderItems
view is used to display sub-folders and/or files. These, extended, views are used
in all of the more familiar view types provided by all list view controls i.e. List,
Details, Icons, etc. The FileListView control automatically switches between its
"item views" when the contents of the file system object list, provided by the FileList
data source component, change.
- Drive and Folder Images
-
Specify your own "stock" images for the various drive types and folders by assigning
image lists to the SmallImages and LargeImages properties. Choose to use Windows XP,
Windows Vista or your own style of image. Developers can use the same image lists
with the FileList component when data binding and initialize the FileList component
to assign the key of the relevant "stock" image to drive and sub-folder items as
they are loaded.
- Automatic Generation of Column Headers
-
By default, the
FileListView control automatically generates the column headers
required for the Details view of both of its own file system specific views i.e.
drive item view and folder/file item view. Developers can customize the automatically
generated column headers or the automatic generation feature can be turned off and
developers can create their own column headers.
- Automatic Generation of Context Menu
-
By default, the
FileListView control automatically generates a context menu that
is displayed when the user right clicks a display item or right clicks in the client
area of the control, different context menu items are displayed for each of the
two right click actions. The context menu raises Click events that can be handled,
in client code, to process the relevant menu commands. Developers can customize
the automatically generated context menu or the automatic generation feature can
be turned off.
- Sorting In All Views
-
The
FileListView control provides sorting in all views, view switching and the placing
of display items in to edit mode from its automatically generated context menu.
Develops can provide their own sorting by handling the ColumnClick event and use
either their own sorting logic or the functionality provided by the FileListView
Sort method.
- User Column Header Editing
-
The
FileListView control provides the user with the functionality to choose, position
and resize column headers from its automatically generated context menu. If the
automatically generated context menu is not being used, developers can provide their
own column header editing using the ChooseDetailsDialog component (see below).
- Automatic Generation of Display Groups
-
By default, the
FileListView control automatically generates display groups for
its own drive item view if the operating system supports grouping in ListView controls.
Developers can customize the automatically generated groups or the automatic group
generation can be turned off.
- Resizing of Column To Match Header
-
The
FileListView control provides the AutoResizeListColumn method that can be used
to resize the only column displayed, when in List view, to match the width of the
column header and prevent the truncation of the label text. When the user switches
view using the automatically generated context menu, the FileListView control calls
this method internally to set the column width.
- Copy to Clipboard and Create Drag and Drop Data
-
The
FileListView control provides the CopyFileItemsToClipboard method that can be
used to copy the selected items to the clipboard in a format that is supported by
most file handling applications e.g. Windows (File) Explorer and the CopyFileItemsForDrag
method that creates a data structure, from the selected items, that can be used
in file drag and drop operations.
FolderDropDownList
The FolderDropDownList control lists and displays a hierarchical node
structure in a way that is similar to the standard combo box control.
FolderDropDownList Control
The purpose of the FolderDropDownList control is to allow the user
to specify the path of a selected node and to facilitate such a selection the control
is typically used in conjunction with another control, such as the FileListView
control, to provide a user interface similar to the standard file open and save
as dialogs.
Some of the key features of the FolderDropDownList control are listed below:
- Data Binding
-
The
FolderDropDownList control may be data bound to the FolderList data source component
to provide the automatic management and display of the file system item data provided
by the FolderList component.
When data binding to the FolderList component, developers can initialize the data source
component with the image index or image key of the "stock" computer, drive
and folder images contained in the FolderDropDownList control's image
list. The FolderList component will initialize each of the file system
items, as they are loaded, to use the relevant image.
- Computer, Drive and Folder Images
-
Specify your own "stock" images for the "virtual" Computer (My Computer on Windows
XP) folder, the various drive types and folders by populating and assigning an image
list to the Images property. Choose to use Windows XP, Windows Vista or your own
style of image.
- Retrieving the Selection
-
The SelectedNode property can be used to retrieve the node that is currently selected
i.e. the node that appears in the top section of the control and the SelectedPath
property can be used to retrieve the full path of the currently selected node.
- Linking to Other Controls
-
The
FolderDropDownList control can be linked to and synchronized with other user
interface controls, such as the FileListView control, using the linking capabilities
of the FileList data source component.
To link the FolderDropDownList control to another control developers can data bind
the FolderDropDownList control to the FolderList data source and then
link the FileList data source to the FolderList data
source component. The FileList data source component
can then be data bound to the FileListView control.
- Add and Remove Nodes From Code
-
When data bound to the FolderList data source component, the
FolderDropDownList
control automatically adds and removes file system nodes in response to user actions and the update
events fired by the FolderList data source component. However, the FolderDropDownList
control does not have to be data bound, nodes can be added to and removed from the
control directly from code. The RootNode property gives calling code access to the
hierarchical list maintained by the FolderDropDownList control and nodes can be
added to or removed from the list to update the selected path display as the user
navigates the hierarchy.
FolderTreeView
The FolderTreeView control is a specialised extension of the standard TreeView control
that fully integrates, through data binding, with the FolderList (see below) data
source component.
FolderTreeView Control
The FolderTreeView control lists and displays a hierarchical node structure that
descends from a single, level zero, root node. The FolderTreeView control provides
an ideal solution for displaying the hierarchical file system object data provided
by the FolderList data source component. However, the FolderTreeView control uses
the IHierarchicalDataSource interface and the other hierarchical data interfaces
contained in the Blayd File System UI library and can therefore data bind to and
display the data of any class that implements these interfaces.
Some of the key features of the FolderTreeView control are listed below:
- Data Binding
-
The
FolderTreeView control may be data bound to the FolderList data source component
to provide the automatic management and display of the file system item data provided
by the FolderList data source component.
When data binding to the FolderList component, developers can initialize the data
source component with the image index or image key of the "stock" computer, drive
and folder images contained in the FolderTreeView control's image list. The FolderList
data source component will initialize each of the file system items, as they are
loaded, to use the relevant image.
The FolderTreeView control can be data bound to any class that implements the IHierarchicalDataSource
interface defined in the Blayd File System UI library. Therefore, developers can
create their own, hierarchical, data source components and bind them to the FolderTreeView
control.
- Computer, Drive and Folder Images
-
Specify your own "stock" images for the "virtual" Computer (My Computer on Windows
XP) folder, the various drive types and folders by populating and assigning an image
list to the ImageList property. Choose to use Windows XP, Windows Vista or your
own style of image.
- Automatic Generation of Context Menu
-
By default, the
FolderTreeView control automatically generates a context menu that
is displayed when the user right clicks a node, The context menu raises Click events
that can be handled, in client code, to process the relevant menu commands. Some
of the context menu commands, such as Expand|Collapse, Rename and
Refresh are automatically
processed by the FolderTreeView control. Developers can customize the automatically
generated context menu or the automatic generation feature can be turned off.
- Linking to Other Controls
-
The
FolderTreeView control can be linked to and synchronized with other user interface
controls, such as the FileListView, using the linking capabilities of the FileList
data source component.
To link the FolderTreeView control to another control developers can data bind the
FolderTreeView control to the FolderList data source and then link the FileList
data source to the FolderList data source component. The FileList data source component
can then be data bound to the FileListView control.
- Copy to Clipboard and Create Drag and Drop Data
-
The
FolderTreeView control provides the CopyDataNodeToClipboard method that can
be used to copy the selected node to the clipboard in a format that is supported
by most file handling applications e.g. Windows (File) Explorer and the CopyDataNodeForDrag
method that creates a data structure, from the selected node, that can be used in
file drag and drop operations.
Components
ChooseDetailsDialog
The ChooseDetailsDialog component provides a dialog box that allows the user to
specify column header settings for an associated instance of the FileListView control.
An instance of the ChooseDetailsDialog component is associated with an instance
of the FileListView control by setting the ViewControl property, either in the designer
or from code or by specifying a control instance in the call to the ShowDialog method.
The ChooseDetailsDialog component cannot be used if it is not associated with a
FileListView control instance because the component queries the associated FileListView
control to determine which column headers to display.
When the FileListView control's AutoGenerateContextMenu property is set to true,
the control uses the ChooseDetailsDialog component to automatically display the
"Choose Details" dialog from the relevant option on its context menu. However, developers
that are not using the automatic context menu generation feature can use the ChooseDetailsDialog
directly from their own code to display the "Choose Details" dialog.
Some of the key features of the ChooseDetailsDialg component are listed below:
- Automatic Display of All Available Columns
-
The
ChooseDetailsDialog component displays all of the column headers that are available
for the associated FileListView control's Details view. The user can choose which
column headers to display in the associated FileListView control.
- Optional Column Header Reorder and Resize
-
The AllowColumnReorder property can be used to specify whether or not the user can
reorder the column headers in the associated FileListView control. The AllowColumnResize
property can be used to specify whether or not the user can change the width of
any selected column headers.
- Automatic Update of Associated FileListView Control
-
By default, the
ChooseDetailsDialog component will update its associated FileListView
control with the settings made by the user in the dialog. However, the PerformUpdate
property can be used to turn this feature off and the GetColumnHeaders method can
then be used to retrieve the column header settings made by the user in the dialog.
FileList
The FileList data source component loads and manages a list of the sub-folders and
files contained in a file sytem folder. The FileList component maintains its list
of sub-folders and files in a list that can be data bound, for example, to the BindingSource
component, the FileListView control and the DataGridView control and to any other
component or control that supports the IListSource interface and the IBindingList
interface.
Some of the key features of the FileList data source component are listed below:
- Lists Devices, Folders and Files
-
The
FileList data source component can list the contents of the "virtual" Computer
(My Computer on Windows XP) folder, the contents of a drive root folder and the
contents of conventional file system folders. Therefore, the list returned by the
FileList component may be a list of drives or it may be a list of sub-folders and/or
files. The FolderPath property is used to specify the file system folder to list.
To list the contents of the "virtual" Computer folder and build a list of drives,
assign the literal value "Computer". To list the contents of a drive and build a
list of sub-folders and files, assign the drive root directory e.g. "C:\". To list
the contents of a folder and build a list of sub-folders and files, assign the folder
path e.g. "C:\FolderName\SubFolderName".
- Drive and Folder Images
-
Specify your own "stock" images for the various drive types and folders by assigning
image lists to the AssociatedImages and AssociatedLargeImages properties. Choose to
use Windows XP, Windows Vista or your own style of image. Developers can use the
same image lists with the FileListView control when data binding and initialize
the
FileList component to assign the key of the relevant "stock" image to drive
and sub-folder items as they are loaded.
- Automatically Assigns Associated File Type Image
-
The
FileList component will populate the image lists referenced by the AssociatedImages
and AssociatedLargeImages properties with the small and large image associated with
each file type that it loads. Controls, such as the FileListView, that are data
bound to the FileList component can use the same image lists and the images they
contain when displaying the list items.
- Assign the File Type Associated Image Directly
-
The
FileList component can be initialized to assign the image associated with a
file type directly to each file system item in its list. If the AssignImages property
is set to true the FileList component will assign the actual image data to each
file system item as it is loaded and initialized. Generally it is more efficient
to use the AssociatedImages property to specify images for file system items. However,
if you are data binding to a component or control that can handle bound image properties,
such as the DataGridView control for example, you may want each file system item
to contain the actual image rather than just its key.
- Link To Other Data Source Components
-
The LinkedDataSource property can be used to link and synchronize the
FileList data
source component with another data source. A linked data source can be any class
that implements the IHierarchicalDataSource interface defined in the Blayd File
System UI library, for example, the FolderList data source component. When linked,
data source components use notification events to synchronize their actions. If
linked data source components are also data bound to user interface controls, the
controls will also receive notification events when the list data changes, prompting
them to update their display.
- Date/Time and Number Formatting
-
The
FileList component uses a default format when initializing file system item
date/time and number properties. However, developers can use the DateTimeFormat
and NumberFormat properties to specify their own, custom, formats for all file system
items loaded by the FileList.
- Use As a Base Class
-
The
FileList data source component and its supporting classes i.e. FileItemBindingList
and FileItem are all extensible, therefore developers can extend these classes to
develop their own, custom, file system data sources.
FolderList
The FolderList data source component loads and manages a hierarchical list of file
system folders and provides data binding functionality to user interface components
and controls through its IHierarchicalDataSource interface implementation. The hierarchical
list created by the FolderList component descends from a single, level zero, root
node. The root node contains a collection of level one nodes, each level one node
contains a collection of level two nodes, etc. etc. down through the folder hierarchy.
Some of the key features of the FolderList data source component are listed below:
- Lists Devices and Folders
-
The root node can be specified as the "virtual" Computer (My Computer on Windows
XP) folder in which case the level one nodes will all be the drives. The root node
can also be specified as a specific drive, "C", "D", etc. in which case the level
one nodes will all be folders. The literal value "System" can also be specified
to instruct the
FolderList component to load the drive containing the operating
system as the root node, regardless of its drive letter. The root node can also
be specified as a specific folder, by setting the RootFolderPath path property,
in which case the level one nodes will all be folders i.e. sub-folders of the root
node folder.
- On Demand Loading For Better Performance
-
The
FolderList component supports "on demand" loading of sub-folders,
the DeferredLoad property can be used to specify that
the FolderList component only loads one level
of sub-folders, rather than the entire hierarchy, during the initial load. This
technique improves performance and reduces resource usage when loading the folder
hierarchy of large disks with lots of folders, however, it does require calling
code or data bound controls to explicitly load sub-folders as or just before they
are accessed or displayed. The FolderTreeView control, which can be data
bound to the FolderList component
fully supports the "on demand" loading provided by the FolderList component.
- Stock Device and Folder Image Index or Key
-
The
FolderList component provides various properties that can be used to specify
either the image index or image key of the "stock" computer, drive and folder images
contained in the image list maintained by the user interface control to which the
FolderList is data bound. The FolderList data source component will determine the
type of each of file system item as it is loaded, e.g. local drive, CD-DVD drive,
remote drive, folder, etc. and assign the relevant image index or key. A data bound
user interface control can then interpret these values and assign the relevant image
from its own image list as it displays each file system item.
- Use as a Data Binding Source or Directly From Code
-
Although the
FolderList data source component is primarily intended to provide file
system data, through data binding, to user interface controls it can be used entirely
from code. Developers can use the FolderList data source component directly from
their own code to load and manage file system device and folder data. Developers
can also develop their own user interface controls to data bind to the FolderList
data source component by including code in their control to interact with the various
hierarchical data interfaces implemented in the Blayd File System UI library.
- Use As a Base Class
-
The
FolderList data source component and its supporting classes i.e. FolderNodeCollection
and FolderNode are all extensible, therefore developers can extend these classes
to develop their own, custom, file system data sources.
Conclusion
Blayd Software's File System UI component and control library is designed to ease
the burden of loading and displaying file system data. By data binding the specialized
tree view, combo box and list view controls to the data source components a developer
can create a functioning user interface without writing any code. The library essentially
provides a read only view of file system devices, folders and files. The data source
components are updatable, therefore folder nodes and file items can be created in
client code and can then be added to the relevant data source list, however the
library never performs any file system writes, so the underlying file system objects
represented by updates to the data source components are not created in the machine's
file system. However, the events implemented in the components and controls do allow
the developer to write code to react to user initiated actions to, for example,
provide any necessary underlying file processing such as file copy, move, delete,
etc. The demonstration project that ships with the File System UI library includes
a fully functional file explorer created using the FolderList and FileList data
source components and the FolderTreeView and FileListView controls. The explorer
demonstrates how to implement folder and file copy, move and delete and also how
to implement folder and file drag and drop operations using the File System UI components
and controls.
Copyright ©Blayd Software Limited 2008-2010. All rights reserved.