I have a following markup that I use often:
<SfDropDownList DataSource="@Model.Customers" TItem="Customer" TValue="Customer">
<DropDownListTemplates TItem="Customer">
<ItemTemplate Context="customer">
<span>@customer.Name</span><span class="float-right">@customer.Site</span>
</ItemTemplate>
</DropDownListTemplates>
</SfDropDownList>
How do I reuse DropDownListTemplates with the same parameters in multiple components?
I was thinking, that I create I create a custom class inherited from DropDownListTemplates:
@inherits DropDownListTemplates<Customer>
@code {
override void OnAfterRender(bool firstRender)
{
// this.ItemTemplate = ??
base.OnAfterRender(firstRender);
}
}
but how do I set ItemTemplate which is a RenderFragment parameter in the base class?
I want to avoid wrapping SfDropDownList to a custom component