I am building component that works similar to windows explorer. When the user is pointing to the each folder it should show the tool tip of each folder's created date. But in the Too tip of all the parent items are showing at the same time.
I wanted the Tooltip to show only on the focusing folders. Can some one solve this Issue?
The working sample of the code https://try.mudblazor.com/snippet/QkmJkdvbsmktfoJi
You will need to use ItemTemplate custom the content and create custom class to extend property for tips. Such as following sample.
<MudTreeView Items="@TreeItems" Hover="true">
<ItemTemplate Context="item">
<MudTreeViewItem Items="@item.Children">
<BodyContent>
<MudTooltip Text="@item.Value.Tip">
<MudText>@item.Value.Text</MudText>
</MudTooltip>
</BodyContent>
</MudTreeViewItem>
</ItemTemplate>
</MudTreeView>
@code {
public class MyItem{
public string Text { get; set; }
public string Tip { get; set; }
}
private List<TreeItemData<MyItem>> TreeItems { get; set; } = [];
protected override void OnInitialized()
{
TreeItems.Add(new TreeItemData<MyItem>{
Value = new MyItem { Text = "Applications"},
Children = [
new TreeItemData<MyItem>{ Value = new MyItem { Text = "Terminal" } },
]
});
TreeItems.Add(new TreeItemData<MyItem>{
Value = new MyItem { Text = "Documents", Tip="doc"},
Children = [
new TreeItemData<MyItem>{
Value = new MyItem { Text = "MudBlazor" ,Tip="blazor"},
Children= [
new TreeItemData<MyItem>{ Value = new MyItem { Text = "API", Tip="api" } },
new TreeItemData<MyItem>{ Value = new MyItem { Text = "Components" ,Tip="com" } },
new TreeItemData<MyItem>{ Value = new MyItem { Text = "Features" ,Tip="fes" } },
]
},
]
});
}
}