To allow control of what to list in FileList and DirectoryTree, e.g. to develop a custom PickDirectoryDialog, which file shouldn’t be listed on the FileList , I have updated these components to include EntryFilter and OnXXXInvoke actions.

EntryFilter (FileList and DirectoryTree)

[Flags]
public enum EntryType
{
    Special = 1 << 1,
    Directory = 1 << 2,
    File = 1 << 3,
    Link = 1 << 4
}

Both DirectoryTree and FileList have a dependency property named EntryFilter, which links to the DirectoryTreeViewModel.EntryFilter.

ExModel have a new function named MatchEntryFilter(), which accepts a EntryFilter, and returns whether the item should be listed.

EntryFilter allows user to specify the item to list, using the EntryType enum.

Noted that some directories or files can have multiple EntryTypes, e.g.

  • Link files (file with an extension .lnk) = EntryType.File | EntryType.Link
  • Most special directories (directory start with :: ) =  EntryType.Directory | EntryType.Special

In that case, matching any of them will get them listed.

OnDirectoryInvoke, OnLinkInvoke and OnFileInvoke actions (FileList only)

public enum CustomAction { Nothing, OpenFolderOrRun, OpenFolder, Run }

You can customize how the FileList react when a user double-click on a directory, link or file, by assign OnXXXInvoked with one of the properties above. OpenFolderOrRun applies to link, as links may be pointed to a directory or file.

public CustomAction DirectoryInvokedAction { get; set; }
public CustomAction FileInvokedAction { get; set; }
public CustomAction LinkInvokedAction { get; set; }

FileListViewModel have implemented the interface ISupportInvoke, which implements the above actions, they are linked to FileList’s OnXXXInvoke dependency properties. The static Invoking code is placed in ExViewModel, so any decedents, e.g. FileListItemViewModel, can use the following method to execute an Invoke action.

protected static void Expand(ISupportInvoke _rootModel, Action changeDirectory, ExModel embeddedModel)