Skip to content

FolderBrowser

0x5BFA edited this page Dec 18, 2024 · 5 revisions

Definition

public partial class FolderBrowser : Control {}
[GDP] public /**/ RootFolder { get; set; }    // IFolder
[GDP] public /**/ Items { get; }              // Getter only
[GDP] public /**/ FolderViewSettings { get; } // Getter only
[GDP] public /**/ ViewMode { get; set; }
[GDP] public /**/ SelectedItems { get; set; }
[GDP] public /**/ ThumbnailSize { get; set; }
[GDP] public /**/ GroupById { get; set; }     // i.e. System.Audio.Format
[GDP] public /**/ SortById { get; set; }      // i.e. System.Audio.Format
[GDP] public /**/ SortDirection { get; set; } // i.e. Ascending
[GDP] public /**/ ItemSpacing { get; set; }

Usage

In Files, FolderBrowser is instantiated in MainPage and its instance is associated to TabBarItem.

// Instantiating with various types of folders
var browser = FolderBrowser() { Folder = new HomeFolder() };
browser =     FolderBrowser() { Folder = new WindowsFolder("Shell:ThisPC") }; // parse-able paths only
browser =     FolderBrowser() { Folder = new TagsFolder(tagId) };
MainPageViewModel.CurrentTabItem.AddPaneAt(browser, index: -1);

// Changing folder from outside (i.e. SidebarView.ItemClicked)
FolderBrowser browser = MainPageViewModel.CurrentTabItem.GetPaneAt(index: -1);
browser.Folder = e.SelectedFolder;

Implementation

<toolkit:SwitchPresenter
    TargetType="controls:FolderViewMode"
    Value="{x:Bind ViewMode, Mode=TwoWay}">
    <toolkit:Case Value="Tree">
        <controls:TreeFolderView
            RootFolder="{x:Bind RootFolder, Mode=TwoWay}"
            Items="{x:Bind Items, Mode=TwoWay}"
            SelectedItems="{x:Bind SelectedItems, Mode=TwoWay}"
            ThumbnailSize="{x:ThumbnailSize, Mode=TwoWay}"
            GroupById="{x:Bind GroupById, Mode=TwoWay}"
            FolderViewSettings="{x:Bind ViewModel.FolderViewSettings, Mode=TwoWay}" ... />
    </toolkit:Case>
    <toolkit:Case Value="SideBySide">
        <controls:SideBySideFolderView ... />
    </toolkit:Case>
    <toolkit:Case Value="Grid">
        <controls:GridFolderView ... />
    </toolkit:Case>
    <toolkit:Case Value="List">
        <controls:ListFolderView ... />
    </toolkit:Case>
    <toolkit:Case Value="Content">
        <controls:ContentFolderView ... />
    </toolkit:Case>
    <toolkit:Case Value="Tiles">
        <controls:TilesFolderView ... />
    </toolkit:Case>
    <toolkit:Case Value="Columns">
        <controls:ColumnsFolderView ... />
    </toolkit:Case>
    <toolkit:Case Value="Details">
        <controls:DetailsFolderView ... />
    </toolkit:Case>
    <toolkit:Case Value="Gallery">
        <controls:GalleryFolderView ... />
    </toolkit:Case>
    <toolkit:Case Value="Home">
        <controls:HomeFolderView ... />
    </toolkit:Case>
    <toolkit:Case Value="Tiles2">
        <controls:Tiles2FolderView ... /> <!--  Used in Home  -->
    </toolkit:Case>
    <toolkit:Case Value="Content2">
        <controls:Content2FolderView ... /> <!--  Used in Home  -->
    </toolkit:Case>
</toolkit:SwitchPresenter>

FolderViewMode

This is not a enum but a string struct that can compared between its instances since user of these controls can add their own view modes.

public readonly partial struct FolderViewMode : IEquatable<FolderViewMode>
{
    string _value;

    public static FolderViewMode DetailsView = (FolderViewMode)"DetailsView";
    public static FolderViewMode GridView = (FolderViewMode)"GridView";
    public static FolderViewMode ListView = (FolderViewMode)"ListView";
    public static FolderViewMode ContentView = (FolderViewMode)"ContentView";

    // Operator overloads
}

IDefaultFolderViewSettings

This represents storable-dependent view settings, which can be instantiated through IFolderViewSettingsProvider implemented in each storable.

public class WindowsFolderViewSettings :
    IDefaultFolderViewSettings,
    IColumnsFolderViewSettings,
    IDetailsFolderViewSettings,
    ITreeFolderViewSettings,
    ISideBySideViewSettings,
    IHomeFolderViewSettings {}

// IDefaultFolderViewSettings
public List<FolderViewMode> GetAvailableViewModes();
public string GetSortById();
public string GetGroupedById();
public FolderViewSortDirection GetSortDirection();
public uint GetItemSpacing();
public uint GetThumbnailSize();

// IColumnsFolderViewSettings
public uint GetColumnWidth(IFolder folder);

// IDetailsFolderViewSettings
public ObservableCollection<ITableViewColumn> DetailsViewAvailableColumns { get; }
public ObservableCollection<ITableViewColumn> DetailsViewVisibleColumns { get; }

// ITreeFolderViewSettings
public bool GetIfFolderIsExpanded(IFolder folder);

// ISideBySideFolderViewSettings
public bool SideBySideTreeViewIsEnabled();

// IHomeFolderViewSettings
public FolderViewMode GetHomeGroupViewMode(string propertyId);
Controls
  • FolderBrowser
  • DetailsFolderView
  • GridFolderView
  • ListFolderView
  • TilesFolderView
  • ContentFolderView
  • ColumnsFolderView
  • TreeFolderView
  • GalleryFolderView
  • HomeFolderView
  • RectanglurSelectionVisual
  • DataGrid
  • SidebarView
  • Omnibar
  • Toolbar
  • FilePreviewPresenter
  • ColorTags
  • RichTokens
  • TerminalView
API
  • WindowsStorable
  • ArchiveStorable
  • HomeStorable
  • FtpStorable
  • SftpStorable
  • WebDAVStorable
Infrastructure
  • CommandManager
  • MultitaskingManager
  • DialogManager
  • AppSettings
  • OperationServer

Copyright © 2025 0x5BFA. All rights reserved. Do not copy or redistribute modified versions.

Clone this wiki locally