I am currently experimenting with templated components in Blazor. I am trying to set up a component with a RenderFragment parameter.
For example:
<div> @this.Content</div>@code { [Parameter] public RenderFragment? Content { get; set; }}When I use it on a Razor page, it looks like this:
<MyComponent><Content></Content></MyComponent>I'd prefer not having to add the <Content> tag every time, but have everything inside the component brackets be the content.
Is there a way to achieve my preferred behavior?
I looked up different ways to pass parameters to a component, but I haven't quite figured out how to remove the need for the additional tags.