Table of Contents

Class MudTreeView<T>

Namespace
MudBlazor
Assembly
MudBlazor.dll
[CascadingTypeParameter("T")]
public class MudTreeView<T> : MudComponentBase, IComponent, IHandleEvent, IHandleAfterRender, IMudStateHasChanged

Type Parameters

T
Inheritance
MudTreeView<T>
Implements
Inherited Members
Extension Methods

Constructors

MudTreeView()

public MudTreeView()

Properties

AutoExpand

Gets or sets whether the tree automatically expands to reveal the selected item.

[Parameter]
[Category("Selecting")]
public bool AutoExpand { get; set; }

Property Value

bool

AutoSelectParent

If true, selecting all children will result in the parent being automatically selected. Unselecting a children will still unselect the parent. Note: This only has an effect in SelectionMode.MultiSelection.

[Parameter]
[Category("Selecting")]
public bool AutoSelectParent { get; set; }

Property Value

bool

CheckBoxColor

Check box color if multiselection is used.

[Parameter]
[Category("Selecting")]
public Color CheckBoxColor { get; set; }

Property Value

Color

CheckedIcon

Custom checked icon.

[Parameter]
[Category("Selecting")]
public string CheckedIcon { get; set; }

Property Value

string

ChildContent

Child content of component.

[Parameter]
[Category("Data")]
public RenderFragment? ChildContent { get; set; }

Property Value

RenderFragment

Classname

protected string Classname { get; }

Property Value

string

Color

The color of the selected TreeViewItem.

[Parameter]
[Category("Selecting")]
public Color Color { get; set; }

Property Value

Color

Comparer

Comparer is used to check if two tree items are equal

[Parameter]
[Category("Selecting")]
public IEqualityComparer<T?> Comparer { get; set; }

Property Value

IEqualityComparer<T>

Dense

If true, compact vertical padding will be applied to all TreeView items.

[Parameter]
[Category("Appearance")]
public bool Dense { get; set; }

Property Value

bool

Disabled

If true, TreeView will be disabled and all its children.

[Parameter]
[Category("Behavior")]
public bool Disabled { get; set; }

Property Value

bool

ExpandOnClick

If true, clicking anywhere on the item will expand it, if it has children.

[Parameter]
[Category("Click action")]
public bool ExpandOnClick { get; set; }

Property Value

bool

ExpandOnDoubleClick

If true, double-clicking anywhere on the item will expand it, if it has children.

[Parameter]
[Category("Click action")]
public bool ExpandOnDoubleClick { get; set; }

Property Value

bool

FilterFunc

Determines whether the TreeItemData<T> is displayed during filtering or not. True is visible and false is invisible.

[Parameter]
[Category("Behavior")]
public Func<TreeItemData<T>, Task<bool>>? FilterFunc { get; set; }

Property Value

Func<TreeItemData<T>, Task<bool>>

Height

Setting a height will allow to scroll the TreeView. If not set, it will try to grow in height. You can set this to any CSS value that the attribute 'height' accepts, i.e. 500px.

[Parameter]
[Category("Appearance")]
public string? Height { get; set; }

Property Value

string

Hover

Hover effect for item's on mouse-over.

[Parameter]
[Category("Appearance")]
public bool Hover { get; set; }

Property Value

bool

IndeterminateIcon

Custom tri-state indeterminate icon.

[Parameter]
[Category("Selecting")]
public string IndeterminateIcon { get; set; }

Property Value

string

ItemTemplate

ItemTemplate for rendering children.

[Parameter]
[Category("Data")]
public RenderFragment<TreeItemData<T>>? ItemTemplate { get; set; }

Property Value

RenderFragment<TreeItemData<T>>

Items

Tree items that will be rendered using the Item

[Parameter]
[Category("Data")]
public IReadOnlyCollection<TreeItemData<T>>? Items { get; set; }

Property Value

IReadOnlyCollection<TreeItemData<T>>

MaxHeight

Setting a maximum height will allow to scroll the TreeView. If not set, it will try to grow in height. You can set this to any CSS value that the attribute 'height' accepts, i.e. 500px.

[Parameter]
[Category("Appearance")]
public string? MaxHeight { get; set; }

Property Value

string

ReadOnly

If true, the selection of the tree view can not be changed by clicking its items. The currently selected value(s) are still displayed however

[Parameter]
[Category("Selecting")]
public bool ReadOnly { get; set; }

Property Value

bool

Ripple

Gets or sets whether to show a ripple effect when the user clicks the button. Default is true.

[Parameter]
[Category("Appearance")]
public bool Ripple { get; set; }

Property Value

bool

SelectedValue

[Parameter]
[Category("Selecting")]
public T? SelectedValue { get; set; }

Property Value

T

SelectedValueChanged

Called whenever the selected value changed.

[Parameter]
public EventCallback<T?> SelectedValueChanged { get; set; }

Property Value

EventCallback<T>

SelectedValues

[Parameter]
[Category("Selecting")]
public IReadOnlyCollection<T>? SelectedValues { get; set; }

Property Value

IReadOnlyCollection<T>

SelectedValuesChanged

Called whenever the selection changes.

[Parameter]
public EventCallback<IReadOnlyCollection<T>?> SelectedValuesChanged { get; set; }

Property Value

EventCallback<IReadOnlyCollection<T>>

SelectionMode

The selection mode determines whether only a single item (SingleSelection) or multiple items can be selected (MultiSelection) and whether the selected item can be toggled off by clicking a second time (ToggleSelection).

[Parameter]
[Category("Selecting")]
public SelectionMode SelectionMode { get; set; }

Property Value

SelectionMode

ServerData

Supply a func that asynchronously loads tree view items on demand

[Parameter]
[Category("Data")]
public Func<T?, Task<IReadOnlyCollection<TreeItemData<T?>>>>? ServerData { get; set; }

Property Value

Func<T, Task<IReadOnlyCollection<TreeItemData<T>>>>

Stylename

protected string Stylename { get; }

Property Value

string

TriState

If true, the checkboxes will use the undetermined state in MultiSelection if any children in the subtree have a different selection value than the parent item.

[Parameter]
[Category("Selecting")]
public bool TriState { get; set; }

Property Value

bool

UncheckedIcon

Custom unchecked icon.

[Parameter]
[Category("Selecting")]
public string UncheckedIcon { get; set; }

Property Value

string

Width

Setting a width the TreeView. You can set this to any CSS value that the attribute 'height' accepts, i.e. 500px.

[Parameter]
[Category("Appearance")]
public string? Width { get; set; }

Property Value

string

Methods

BuildRenderTree(RenderTreeBuilder)

protected override void BuildRenderTree(RenderTreeBuilder __builder)

Parameters

__builder RenderTreeBuilder

CollapseAllAsync()

Collapses all items and their children recursively.

public Task CollapseAllAsync()

Returns

Task

ExpandAllAsync()

Expands all items and their children recursively.

public Task ExpandAllAsync()

Returns

Task

FilterAsync()

Invokes the FilterFunc to be applied to every item.

public Task FilterAsync()

Returns

Task

A task to represent the asynchronous operation.

OnAfterRenderAsync(bool)

protected override Task OnAfterRenderAsync(bool firstRender)

Parameters

firstRender bool

Returns

Task