Class DropDownListTemplates<TItem>
Provides customization options for rendering list items, group titles, selected values, headers, and footers in the SfDropDownList
component.
Inheritance
System.Object
Syncfusion.Blazor.DropDowns.Internal.DropDownsTemplates<TItem>
DropDownListTemplates<TItem>
Namespace: Syncfusion.Blazor.DropDowns
Assembly: Syncfusion.Blazor.dll
Syntax
public class DropDownListTemplates<TItem> : DropDownsTemplates<TItem>
Type Parameters
Name | Description |
---|---|
TItem | The type of items displayed in the dropdown list. |
Remarks
Note: TItem
is a type parameter for the DropDownListTemplates class and not referenceable by XML cref
attributes.
SfDropDownList
component, enhancing its visual and functional flexibility.
Examples
<SfDropDownList TItem="string" TValue="string" DataSource="@MyList">
<DropDownListTemplates>
<ValueTemplate Context="item">
<span>@item.Text - Custom</span>
</ValueTemplate>
</DropDownListTemplates>
</SfDropDownList>
@code {
protected List<string> MyList = new List<string> { "Small", "Medium", "Large" };
}
Constructors
DropDownListTemplates()
Declaration
public DropDownListTemplates()
Properties
ValueTemplate
Gets or sets the template for rendering the selected item in the input element.
Declaration
public RenderFragment<TItem> ValueTemplate { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.RenderFragment<TItem> | A Microsoft.AspNetCore.Components.RenderFragment that defines the template for the selected item. The default value is |
Remarks
This property allows customization of the selected item's appearance in the input element of the SfDropDownList
component. The template receives the selected item as context for rendering.
Examples
<SfDropDownList TItem="string" TValue="string" DataSource="@MyList">
<DropDownListTemplates>
<ValueTemplate Context="item">
<span>@item.Text - Selected</span>
</ValueTemplate>
</DropDownListTemplates>
</SfDropDownList>
@code {
protected List<string> MyList = new List<string> { "Small", "Medium", "Large" };
}