Consider a simple blazor component MyText
<p>@Title</p>
public partial class MyText
{
[Parameter] public string Title { get; set; }
}
In page I use it as:
<MyText Title="Abc" />
Now I would like to extend this component but do not want to change it, rather derive it by a new component MyTextEx and add another parameter. Something like:
@inherits MyText
<!-- Show base component something like: --!>
@base
<p>@Message</p>
public partial class MyTextEx
{
[Parameter] public string Message { get; set; }
}
What I could not find how to display the base component's content? So it is rendered as:
<p>@Title</p>
<p>@Message</p>
Note this is a simplified example and my base component has a lot of parameters, events and hoping for virtual methods which could be overridden by extended/derived component. I'm trying to avoid composition like approach in razor file for base component because AFAIK I have to again populate it with parameters:
@inherits MyText
<MyText Title="@Title" />
<p>@Message</p>
I was able to find inheritance examples with base/abstract components, but could not find inheritance with final components.
Any idea how to achieve this?
Thanks, Csaba