API

Folders

A folder appears in a tree and is used to help organise the tree structure by grouping things together. Folders can be added to a tree instance or any other folder instance allowing you to create a hierarchical structure of limitless depth and can contain either other folders or collections.

Defining a folder

You define a folder by calling one of the AddFolder methods on a given FluidityTreeConfig or parent FluidityFolderConfig instance.

AddFolder(string name, Lambda folderConfig = null) : FluidityFolderConfig

Adds a folder to the current tree with the given name and a default folder icon.

// Example
treeConfig.AddFolder("Settings", folderConfig => {
    ...
});

AddFolder(string name, string icon, Lambda folderConfig = null) : FluidityFolderConfig

Adds a folder to the current tree with the given name + icon.

// Example
treeConfig.AddFolder("Settings", "icon-settings", folderConfig => {
    ...
});

Changing a folder alias

SetAlias(string alias) : FluidityFolderConfig

Sets the alias of the folder.

Optional: When creating a new folder, an alias is automatically generated from the supplied name for you, however you can use the SetAlias method to override this should you need a specific alias.

// Example
folderConfig.SetAlias("settings");

Changing a folder icon color

SetIconColor(string color) : FluidityFolderConfig

Sets the folder icon color to the given color. Possible options are black, green, yellow, orange, blue or red.

// Example
folderConfig.SetIconColor("blue");

Adding a child folder to a folder

AddFolder(string name, Lambda folderConfig = null) : FluidityFolderConfig

Adds a child folder to the current folder with the given name and a default folder icon.

// Example
folderConfig.AddFolder("Categories", childFolderConfig => {
    ...
});

AddFolder(string name, string icon, Lambda folderConfig = null) : FluidityFolderConfig

Adds a child folder to the current folder with the given name + icon.

// Example
folderConfig.AddFolder("Categories", "icon-tags", childFolderConfig => {
    ...
});

Adding a collection to a folder

AddCollection<TEntityType>(Lambda idFieldExpression, string nameSingular, string namePlural, string description, Lambda collectionConfig = null) : FluidityCollectionConfig<TEntityType>

Adds a collection to the current folder with the given names and description and default icons. An ID property accessor expression is required so that Fluidity knows which property is the ID property. See the Collections API documentation for more info.

// Example
folderConfig.AddCollection<Person>(p => p.Id, "Person", "People", "A collection of people", collectionConfig => {
    ...
});

AddCollection<TEntityType>(Lambda idFieldExpression, string nameSingular, string namePlural, string description, string iconSingular, string iconPlural, Lambda collectionConfig = null) : FluidityCollectionConfig<TEntityType>

Adds a collection to the current folder with the given names, description and icons. An ID property accessor expression is required so that Fluidity knows which property is the ID property. See the Collections API documentation for more info.

// Example
folderConfig.AddCollection<Person>(p => p.Id, "Person", "People", "A collection of people", "icon-umb-users", "icon-umb-users", collectionConfig => {
    ...
});