|
@using Syncfusion.Blazor.Navigations
<SfTreeView TValue="MailItem" CssClass="CustomTree" ShowCheckBox="true">
<TreeViewFieldsSettings TValue="MailItem" Id="Id" DataSource="@MyFolder" Text="FolderName" HtmlAttributes="htmlAttributes" ParentID="ParentId" HasChildren="HasSubFolders" Expanded="Expanded"></TreeViewFieldsSettings>
</SfTreeView>
@code{
public class MailItem
{
public string Id { get; set; }
public string ParentId { get; set; }
public string FolderName { get; set; }
public bool Expanded { get; set; }
public bool HasSubFolders { get; set; }
public Dictionary<string, object> htmlAttributes { get; set; }
}
List<MailItem> MyFolder = new List<MailItem>();
protected override void OnInitialized()
{
base.OnInitialized();
MyFolder.Add(new MailItem
{
Id = "1",
FolderName = "Inbox",
HasSubFolders = true,
Expanded=true,
htmlAttributes = new Dictionary<string, object> { { "class" , "hide"} }
});
MyFolder.Add(new MailItem
{
Id = "2",
ParentId = "1",
HasSubFolders = true,
FolderName = "Categories",
Expanded=true,
htmlAttributes = new Dictionary<string, object> { { "class", "hide" } }
});
MyFolder.Add(new MailItem
{
Id = "3",
ParentId = "2",
FolderName = "Primary"
});
}
<style>
.CustomTree .e-list-item.hide > .e-text-content .e-checkbox-wrapper {
display: none
}
</style> |