Table of Contents

Class MudTreeViewItem<T>

Namespace
MudBlazor
Assembly
MudBlazor.dll
public class MudTreeViewItem<T> : MudComponentBase, IComponent, IHandleEvent, IHandleAfterRender, IMudStateHasChanged, IDisposable

Type Parameters

T
Inheritance
MudTreeViewItem<T>
Implements
Inherited Members
Extension Methods

Constructors

MudTreeViewItem()

public MudTreeViewItem()

Properties

BodyContent

Content of the item body, if used replaced the text, end text and end icon rendering.

[Parameter]
[Category("Behavior")]
public RenderFragment<MudTreeViewItem<T?>>? BodyContent { get; set; }

Property Value

RenderFragment<MudTreeViewItem<T>>

CanExpand

If false, TreeViewItem will not be able to expand.

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

Property Value

bool

Remarks

This is especially useful for lazy-loaded items via ServerData. If you know that an item has no children you can pre-emptively prevent expansion which would only lead to a server request that would not return children anyway.

ChildContent

Child content of component used to create sub levels.

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

Property Value

RenderFragment

Classname

protected string Classname { get; }

Property Value

string

Content

Content of the item, if used completely replaced the default rendering.

[Parameter]
[Category("Behavior")]
public RenderFragment? Content { get; set; }

Property Value

RenderFragment

ContentClassname

protected string ContentClassname { get; }

Property Value

string

Disabled

If true, TreeViewItem will be disabled.

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

Property Value

bool

EndIcon

Icon placed after the text if set.

[Parameter]
[Category("Behavior")]
public string? EndIcon { get; set; }

Property Value

string

EndIconColor

The color of the icon. It supports the theme colors.

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

Property Value

Color

EndText

The text at the end of the item.

[Parameter]
[Category("Behavior")]
public string? EndText { get; set; }

Property Value

string

EndTextClass

User class names for the endtext, separated by space.

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

Property Value

string

EndTextTypo

Typography for the endtext.

[Parameter]
[Category("Appearance")]
public Typo EndTextTypo { get; set; }

Property Value

Typo

ExpandButtonIcon

The expand/collapse icon.

[Parameter]
[Category("Expanding")]
public string ExpandButtonIcon { get; set; }

Property Value

string

ExpandButtonIconColor

The color of the expand/collapse button. It supports the theme colors.

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

Property Value

Color

Expanded

Expand or collapse TreeView item when it has children. Two-way bindable. Note: if you directly set this to true or false (instead of using two-way binding) it will force the item's expansion state.

[Parameter]
[Category("Expanding")]
public bool Expanded { get; set; }

Property Value

bool

ExpandedChanged

Called whenever expanded changed.

[Parameter]
public EventCallback<bool> ExpandedChanged { get; set; }

Property Value

EventCallback<bool>

Icon

Icon placed before the text if set.

[Parameter]
[Category("Behavior")]
public string? Icon { get; set; }

Property Value

string

IconColor

The color of the icon. It supports the theme colors.

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

Property Value

Color

IconExpanded

Alternative icon to show instead of Icon if expanded.

[Parameter]
[Category("Behavior")]
public string? IconExpanded { get; set; }

Property Value

string

Items

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

Property Value

IReadOnlyCollection<TreeItemData<T>>

LoadingIcon

The loading icon.

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

Property Value

string

LoadingIconColor

The color of the loading. It supports the theme colors.

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

Property Value

Color

OnClick

Tree item click event.

[Parameter]
public EventCallback<MouseEventArgs> OnClick { get; set; }

Property Value

EventCallback<MouseEventArgs>

OnDoubleClick

Tree item double click event.

[Parameter]
public EventCallback<MouseEventArgs> OnDoubleClick { get; set; }

Property Value

EventCallback<MouseEventArgs>

ReadOnly

If true, the MudTreeViewItem's selection can not be changed.

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

Property Value

bool

Selected

Set this to true to mark the item initially selected in single selection mode or checked in multi selection mode. You can two-way bind this to get selection updates from this item

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

Property Value

bool

SelectedChanged

Called whenever the selected value changed.

[Parameter]
public EventCallback<bool> SelectedChanged { get; set; }

Property Value

EventCallback<bool>

Text

The text to display

[Parameter]
[Category("Behavior")]
public string? Text { get; set; }

Property Value

string

TextClass

User class names for the text, separated by space.

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

Property Value

string

TextClassname

public string TextClassname { get; }

Property Value

string

TextTypo

Typography for the text.

[Parameter]
[Category("Appearance")]
public Typo TextTypo { get; set; }

Property Value

Typo

Value

Value of the TreeViewItem. Acts as the displayed text if no text is set.

[Parameter]
[Category("Data")]
public T? Value { get; set; }

Property Value

T

Visible

Indicates whether the tree view item and its children are visible.

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

Property Value

bool

Methods

BuildRenderTree(RenderTreeBuilder)

protected override void BuildRenderTree(RenderTreeBuilder __builder)

Parameters

__builder RenderTreeBuilder

CollapseAllAsync()

Collapse this item and all its children recursively

public Task CollapseAllAsync()

Returns

Task

Dispose()

public void Dispose()

ExpandAllAsync()

Expand this item and all its children recursively

public Task ExpandAllAsync()

Returns

Task

OnInitializedAsync()

protected override Task OnInitializedAsync()

Returns

Task

OnParametersSet()

protected override void OnParametersSet()

ReloadAsync()

Clear the tree items, and try to reload from server.

public Task ReloadAsync()

Returns

Task