alexa
menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Search Results for

    Show / Hide Table of Contents

    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
    object
    ComponentBase
    OwningComponentBase
    SfOwningComponentBase
    ListBoxFieldSettings
    Implements
    IComponent
    IHandleEvent
    IHandleAfterRender
    IDisposable
    Inherited Members
    ComponentBase.Assets
    ComponentBase.AssignedRenderMode
    ComponentBase.BuildRenderTree(RenderTreeBuilder)
    ComponentBase.DispatchExceptionAsync(Exception)
    ComponentBase.InvokeAsync(Action)
    ComponentBase.InvokeAsync(Func<Task>)
    ComponentBase.OnAfterRender(bool)
    ComponentBase.OnAfterRenderAsync(bool)
    ComponentBase.OnInitialized()
    ComponentBase.OnParametersSet()
    ComponentBase.OnParametersSetAsync()
    ComponentBase.RendererInfo
    ComponentBase.SetParametersAsync(ParameterView)
    ComponentBase.ShouldRender()
    ComponentBase.StateHasChanged()
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    OwningComponentBase.IsDisposed
    OwningComponentBase.ScopedServices
    Namespace: Syncfusion.Blazor.DropDowns
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class ListBoxFieldSettings : SfOwningComponentBase, IComponent, IHandleEvent, IHandleAfterRender, IDisposable
    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
    [Parameter]
    public string GroupBy { get; set; }
    Property Value
    Type
    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
    [Parameter]
    public string HtmlAttributes { get; set; }
    Property Value
    Type Description
    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
    [Parameter]
    public string IconCss { get; set; }
    Property Value
    Type Description
    string

    The property name from your data source that provides icon CSS classes or image references. Default is null (no icons are rendered).

    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
    [Parameter]
    public string Text { get; set; }
    Property Value
    Type
    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
    [Parameter]
    public string Value { get; set; }
    Property Value
    Type
    string
    Remarks

    The value field is used for selection, identification, and data binding scenarios in the ListBox.

    Methods

    Dispose(bool)

    Declaration
    protected override void Dispose(bool disposing)
    Parameters
    Type Name Description
    bool disposing
    Overrides
    OwningComponentBase.Dispose(bool)

    OnInitializedAsync()

    Declaration
    protected override Task OnInitializedAsync()
    Returns
    Type
    Task
    Overrides
    ComponentBase.OnInitializedAsync()

    Implements

    IComponent
    IHandleEvent
    IHandleAfterRender
    IDisposable
    In this article
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved