Proposal: Allow base component classes to augment the generated BuildRenderTree output #12350
Labels
area-blazor
Includes: Blazor, Razor Components
enhancement
This issue represents an ask for new feature or an enhancement to an existing one
Milestone
Please note: This is related to #9857 but that is already closed, therefore a new proposal...
I am trying to add common functionality to a hierarchy of components by overriding the
BuildRenderTree
method in a common base class like this:StyledComponentBase.cs
StyledParentComponent.razor
But this scenario does not work, because the generated
StyledParentComponent
class' overridenBuildRenderTree
method does not call the base class (as noted in #9857):obj\Debug\netstandard2.0\Razor\Components\StyledParentComponent.razor.g.cs
It would be very useful IMHO, to add the possibility for base component classes to somehow augment the markup produced by derived classes generated from
.razor
files. For exampleComponentBase
could introduce two newvirtual
methods:And the
.razor
compiler would include calls to the methods in the generated code like this:The text was updated successfully, but these errors were encountered: