Library Blazor Components DropDownList DropDownList ItemTemplate

ItemTemplate

Template used for rendering of every item from ItemsSource list.

razor
[Parameter]
public RenderFragment<RenderContext<T>> ItemTemplate { get; set; } = context => @<span>@context.Value</span>;

Example

razor
<DropDownList T="Person" ItemsSource="Persons">
    <ItemTemplate>
        <div class="avatar">
            <img src="images/avatar.png">
        </div>
        <div class="details">
            <span>@context.Value.Name</span>
            <span>Age: @context.Value.Age.ToString()</span>
        </div>
    </ItemTemplate>
</DropDownList>

Sign in