I'm trying to make a Blazor component that I will then specialize and override some methods.
Base Component ZoomList:
@inherits ComponentBase<div><table class="table"><thead><tr> @foreach (var str in Headers()) {<th>@str</th> }</tr></thead><tbody> @foreach (var item in items) {<tr> @foreach (var str in Rows(item)) {<td>@str</td> }</tr> }</tbody></table></div>@code { [Parameter] public List<Object> items { get; set; } protected virtual List<string> Rows(Object item) { return new List<string>() { "Placeholder" }; } protected virtual List<string> Headers() { return new List<string>() { "Placeholder" }; }}Derivated component ZoomCampaign:
@inherits ZoomList@using MyNamespace.Model@{ this.BuildRenderTree(__builder);}@code { protected override List<string> Rows(Object item) { Campaign camp = item as Campaign; return new List<string>() { camp.Id.ToString(), camp.Nom }; } protected override List<string> Headers() { return new List<string>() { "#", "Name" }; }}ZoomCampaign is then called from another page.But this.BuildRenderTree(__builder) doesn't use the overridden methods but is using the base methods.=> My html array is contains the "Placeholder" text, not the text defined in override methods Rows and Headers from ZoomCampaign.
What am I missing? How can I change it so that override methods are the ones that are used during rendering ?