Hi,
first of all I'd like to thank you for your great library.
I'm pretty new to Radzen and also to Blazor development, so please bear with me if I'm not seeing th full picture, yet.
Currently I am working on a RadzenTree and there's one thing I can't seem to get quite right.
I'd love to start with an element in the tree selected and have the tree expanded all the way down to that element.
The selection works, but I have to manually drill down to the parent until the Change event is fired. I provided my data model with an Expanded property, but that only works on the first level (probably because of only one RadzenTreeLevel element?)
Here's my tree definition:
<RadzenTree Data=@treeItems Expand=@LoadTreeFiles Change=@OnSelectionChange @bind-Value=@selectedTreeItem >
<RadzenTreeLevel Text=@GetTextForTreeNode Template=@FileOrFolderTreeTemplate Expanded=@(data => ((TreeItem<DataElementTreeModel>)data).Expanded) />
</RadzenTree>
and my data model:
public class TreeItem<T>
{
public T Item { get; set; }
public IEnumerable<TreeItem<T>> Children { get; set; }
public bool Expanded { get; set; }
public TreeItem<T> FindNode(Func<T, bool> predicate)
{
if (predicate(this.Item))
{
return this;
}
foreach (var child in this.Children ?? Enumerable.Empty<TreeItem<T>>())
{
var found = child.FindNode(predicate);
if (found != null)
{
return found;
}
}
return null;
}
}
Can anybody point me to the right direction? Any help is highly appreciated.
Thanks for your support!