Template construction in code

I would like to show a data grid when a tree is expanded. I see that on the TreeItemSettings there is a Template property (RenderFragment<RadzenTreeItem>). It seems to use this property one needs to construct what would be in the .razor file. I was wondering two things 1) am I looking at this correctly? 2) Is there an example that I can look at that shows how a template is constructed in code?