Skip to content

Blazor - IsSectionDefined - SectionOutlet has Content #52477

@mkalinski93

Description

@mkalinski93

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

Hello, I´m looking for a way to find out if a SectionOutlet has content.
It could be really helpful to determine if a section has been populated to structure the overall layout.

Describe the solution you'd like

First option

<SectionOutlet SectionName="SubMenu">
    <NoContent> The content you can set when no Section has been set </NoContent>
</SectionOutlet>

Second option

@if(_hasContent){
   <DoStuff/>
}

<SectionOutlet @ref="_section" SectionName="SubMenu">
    <NoContent> The content you can set when no Section has been set </NoContent>
</SectionOutlet>

@code{
   private SectionOutlet _section;
   private bool _hasContent => _section.Content is not null;
}

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-blazorIncludes: Blazor, Razor Components

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions