ant-design-blazor/components/tree/Tree.razor
James Yeung 063e404af3 feat(module: tree): add ChildContent for Tree and TreeNode (#1887)
* feat(module: tree): add ChildContent for Tree and TreeNode

Allow user set tree nodes directly.

* fix indent
2021-08-29 14:18:36 +08:00

27 lines
731 B
C#

@namespace AntDesign
@inherits AntDomComponentBase
@typeparam TItem
<div class="@ClassMapper.Class" style="@Style" @ref="Ref">
<div class="ant-tree-list">
<div class="ant-tree-list-holder-inner">
<CascadingValue Value="this" Name="Tree" IsFixed="@true">
@if (DataSource != null)
{
foreach (var item in DataSource)
{
<TreeNode DataItem="@item" @key="item.GetHashCode()"></TreeNode>
}
}
else if (ChildContent!=null)
{
@ChildContent
}
else
{
@Nodes
}
</CascadingValue>
</div>
</div>
</div>