Class ListBoxFieldSettings
Configures the field-mapping settings (such as icon CSS, group by, text, and value fields) for data items in a SfListBox<TValue, TItem> component.
Inheritance
Namespace: Syncfusion.Blazor.DropDowns
Assembly: Syncfusion.Blazor.dll
Syntax
public class ListBoxFieldSettings : OwningComponentBase
Remarks
Set these options to customize how the ListBox displays, groups, and interprets your data source. Field mapping enables advanced visualization and data-driven customization of list items.
Examples
This example shows how to assign custom fields to a ListBox for mapping ID, display text, and grouping.
<SfListBox Value="@value" DataSource="@vehicleData" TValue="string[]" TItem="ListItem">
<ListBoxFieldSettings Text="Text" Value="ID" IconCss="icon-class" GroupBy="Type"></ListBoxFieldSettings>
</SfListBox>
@code {
private string[] value = new[] { "List-01" };
private List<ListItem> vehicleData = new List<ListItem> {
new ListItem { Text = "Hennessey Venom", ID = "List-01", Type = "Car", IconCss = "car-icon" },
new ListItem { Text = "Bugatti Chiron", ID = "List-02", Type = "Car", IconCss = "car-icon" },
new ListItem { Text = "Custom Bike", ID = "List-03", Type = "Bike", IconCss = "bike-icon" }
};
public class ListItem {
public string Text { get; set; }
public string ID { get; set; }
public string Type { get; set; }
public string IconCss { get; set; }
}
}
Constructors
ListBoxFieldSettings()
Declaration
public ListBoxFieldSettings()
Properties
GroupBy
Gets or sets the property name used to group ListBox items by category in the UI.
Declaration
public string GroupBy { get; set; }
Property Value
Type |
---|
System.String |
Remarks
Assign a data property to this setting to visually separate items by that field’s value (for example, group by "Category").
Examples
<ListBoxFieldSettings GroupBy="Category" ... />
HtmlAttributes
Gets or sets additional, custom HTML attributes to be applied to the ListBox container element.
Declaration
public string HtmlAttributes { get; set; }
Property Value
Type | Description |
---|---|
System.String | A string containing one or more inline attributes to be added to the ListBox container. |
Remarks
Use this only for legacy scenarios; modern attribute splatting should use the @attributes
directive on the ListBox component in your markup. This field is rarely needed.
IconCss
Gets or sets the name of the property that contains CSS class(es) (or image URLs) to decorate each ListBox item with an icon or image.
Declaration
public string IconCss { get; set; }
Property Value
Type | Description |
---|---|
System.String | The property name from your data source that provides icon CSS classes or image references. Default is |
Remarks
Supply a data property (for example, "IconCss") containing the icon classes or image URLs for each row.
Text
Gets or sets the name of the property that provides the display text for each ListBox item.
Declaration
public string Text { get; set; }
Property Value
Type |
---|
System.String |
Remarks
This property maps your data model to what will be rendered as the visible label inside the ListBox items.
Value
Gets or sets the name of the property that provides the unique item value for each ListBox element.
Declaration
public string Value { get; set; }
Property Value
Type |
---|
System.String |
Remarks
The value field is used for selection, identification, and data binding scenarios in the ListBox.
Methods
Dispose(Boolean)
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing |
OnInitializedAsync()
Declaration
protected override Task OnInitializedAsync()
Returns
Type |
---|
System.Threading.Tasks.Task |