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

Blazor Component only displays the RenderFragment Parameter

$
0
0

I have created a simple Blazor Component for my project that has a button on top and and a conditional rendering where I pass a RenderFragment type. Here the component.

<div class=""><button class="btn btn-link w-100" @onclick="Toggle"><b>GroupTitle</b></button>    @if (!ShowContent)    {<div>            @CollapsibleContent</div>    }</div>@code {    [Parameter]     public string? GroupTitle { get; set; }    [Parameter]     public RenderFragment CollapsibleContent { get; set; }    public bool ShowContent { get; set; } = false;    public void Toggle() {        ShowContent = !ShowContent;    }}

My problem is that ONLY the @CollapsibleContentdisplays and not the button! Even when I inspect the web page things look off.Inspected Content on Web Page

I have tried to change some elements and add some simple text to see if it shows up but it does not work.

Here is how I implement the component:

<div class="d-flex flex-row"><div class="d-flex flex-column" style="min-width: 100;">        @foreach(var pair in Menu)        {<CollapsibleMenu GroupTitle="@pair.Key"><CollapsibleContent><ul class="list-group">                        @foreach(DataRow row in pair.Value)                        {<li class="list-group-item">                                @(row["SortOrder"])</li>                        }</ul></CollapsibleContent></CollapsibleMenu>         }</div></div>

Viewing all articles
Browse latest Browse all 4839

Trending Articles



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