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

How to add childcomponent to mudstack in my code

$
0
0
 private RenderFragment RenderSimpleElement() => builder =>    {        int seq = 0;        builder.OpenComponent<MudStack>(seq++);        builder.AddAttribute(seq++,"Child","");        builder.OpenComponent<StoragePlace>(seq++);        builder.AddAttribute(seq++, "Name", "kukuku");        builder.AddAttribute(seq++, "Width", "180px");        builder.AddAttribute(seq++, "Height", "260px");        builder.CloseComponent();        builder.OpenComponent<StoragePlace>(seq++);        builder.AddAttribute(seq++, "Name", "hahaha");        builder.AddAttribute(seq++, "Width", "180px");        builder.AddAttribute(seq++, "Height", "260px");        builder.CloseComponent();        builder.CloseComponent();    };

this cant work!I can compile it, but when rendering this interface, the following error occurs. I think it might not be possible to add child components to the mud stack like this:

System.AggregateException: One or more errors occurred. (Error: No element is currently associated with component 78) ---> System.InvalidOperationException: Error: No element is currently associated with component 78

so what is the correct method?i need to add childcomponent to mudstack this way.


Viewing all articles
Browse latest Browse all 4839

Trending Articles