Expand hierarchy in TreeView

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!

Hi @fuschnick,

You need to make sure all parents are expanded and not just the immediate one. I am not sure how you populate the tree but make sure the Expanded property of your TreeItem class is correctly set. You can also check my reply in this thread: RadzenTree not showing correct state in UI after reload - #11 by korchev

Hi @korchev,
thank you for replying so quickly. I followed your link and fiddled around a bit and now it works as expected. I guess my mistake was the missing

ChildrenProperty="Children"

property.

My tree now looks like this and everything's golden:

<RadzenTree Data=@treeItems Expand=@LoadTreeFiles Change=@OnSelectionChange @bind-Value=@selectedTreeItem>
    <RadzenTreeLevel Text=@GetTextForTreeNode Template=@TreeTemplate ChildrenProperty="Children" Expanded=@ShouldExpand HasChildren=HasChildren />
</RadzenTree>

Thanks again for your support.
Cheers!