Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Blazor Renderfragment RenderTreeBuilder Parent / Childs

$
0
0

I use

RenderFragment MyRenderFragment() {     return builder => { switch (item.Name) { case .... 

to run components and it works great.Now I want to use this on a parent / childs example but I can't work it out.

For example this one :

<RadzenRadioButtonList @bind-Value=@value TValue="int"><Items><RadzenRadioButtonListItem Text="Orders" Value="1" /><RadzenRadioButtonListItem Text="Employees" Value="2" /><RadzenRadioButtonListItem Text="Customers" Value="3" /></Items></RadzenRadioButtonList>

I tried this code :

builder.OpenComponent<RadzenRadioButtonList<int>>(0);builder.AddAttribute(1, "Value", value);builder.AddAttribute(2, "ValueChanged", EventCallback.Factory.Create<T>(this, async (T e) =>{    await ValueChanged.InvokeAsync(e);}));builder.AddAttribute(3, "TValue", typeof(int));builder.AddAttribute(5, "ChildContent", (RenderFragment)((builder2) =>{    // I tried with foreach and get data from List<> but not work, tried with singledata but this will not work neither.    builder2.OpenComponent<RadzenRadioButtonListItem<int>>(6);    builder2.AddAttribute(7, "Text", "Orders");    builder2.AddAttribute(8, "Value", 1);    builder2.CloseComponent();}builder.CloseComponent();

But it will not work. Anyone who knows how to use this in parent / childs relations?


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>