Issues with Tree component

Hi Radzen team,

few questions from playing with the Tree component with Blazor which are undoubtedly rooted in my own ignorance...

  1. When looking at the source code of the Radzen Blazor Components, I have a bit of a hard time figuring out how to port that code to the Razden IDE... Could you provide more examples geared towards Radzen IDE users? Or could you provide some explanation on how to migrate from thoses samples to the IDE?
  2. I often find myself writing code from Visual Studio and then trying to "reverse-engineer" it back into the Radzen IDE... I guess sometimes the IDE becomes burdensome and it would be nice to be able to just write C# code directly into Visual Studio... For example the Expand event of the tree component!
  3. In the Load on demand paragraph of the Blazor Tree documentation, you have the following code:
<RadzenTree Data="@Northwind.Categories" Expand="@OnExpand">
    <RadzenTreeLevel TextProperty="CategoryName"/>
@code {
    void OnExpand(TreeExpandEventArgs args)
        var category = args.Value as Category;

        args.Children.Data = category.Include(c => c.Products).Products;
        args.Children.TextProperty = "ProductName";
        args.Children.HasChildren = (product) => false;

I believe category.Include() is not valid. but I would expect the following code to work:
args.Children.Data = catgegory.Products;
but catgory.Products is null... how can I retrieve the children of an object when retrieving that object?

I hope this makes sense... Thanks!

Those examples are mostly a demonstration of the Radzen.Blazor free component library and target users who may not be using Radzen.

Radzen provides support for custom methods which is what you describe

The code category.Include() is valid. This is how entity framework loads children on demand and if you omit that code category.Products will remain null.

We will update the Tree help article to include some tips for using the component with Radzen - will show data-binding to Category-Products (similar to the online demo) and self-referencing hierarchy (Employees).

Thanks, getting more documentation on how to use these components from the Radzen IDE with some real life examples would be most appreciated, especially for users like me who use your IDE because we may not be as proficient developers as some of those who use your free components :slight_smile: I think it would fit well with your targeted customers.

As far as category.Include(), Include() is not a valid method for a single object, it only applies to a collection of objects, more like context.Categories.Include(c => c.Products). Your own code in the online demo Blazor Tree | a free UI component by Radzen simply uses category.Products without Include(). So how can I accomplish what category.Include(c => c.Products).Products is trying to accomplish? (this code won't compile)


Check the updated tree documentation.

This is perfect, thanks!