Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class ListBoxFieldSettings

    Show / Hide Table of Contents

    Class ListBoxFieldSettings

    Specifies the fields settings such as IconCss, GroupBy, Text, and Value in a ListBox.

    Inheritance
    System.Object
    ListBoxFieldSettings
    Namespace: Syncfusion.Blazor.DropDowns
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class ListBoxFieldSettings : OwningComponentBase
    Examples

    The below code example, showcases a SfListBox<TValue, TItem> component with fiels settings option.

    <SfListBox Value="@value" DataSource="@vehicleData" TValue="string[]" TItem="ListItem">
        <ListBoxFieldSettings Text="Text" Value="ID"></ListBoxFieldSettings>
    </SfListBox>
    @code{
        private string[] value= new string[] { "List-01"};
        private List<ListItem> vehicleData = new List<ListItem>{
            new ListItem { Text = "Hennessey Venom", ID = "List-01"},
            new ListItem { Text = "Bugatti Chiron", ID = "List-02"},
            new ListItem { Text = "Bugatti Veyron Super Sport", ID = "List-03"}
        }
        public class ListItem
        {
            public string Text { get; set; }
            public string ID { get; set; }
         }
    }

    Constructors

    ListBoxFieldSettings()

    Declaration
    public ListBoxFieldSettings()

    Properties

    GroupBy

    Gets or sets the name of the field used to group the items in the SfListBox<TValue, TItem>.

    Declaration
    public string GroupBy { get; set; }
    Property Value
    Type Description
    System.String
    Examples

    The below code example, showcases a SfListBox<TValue, TItem> component with grouping.

    @using Syncfusion.Blazor.DropDowns
    <SfListBox TValue="string[]" DataSource="@VegetableData" TItem="VegetableDetail">
         <ListBoxFieldSettings GroupBy = "Category" Text="Vegetable" Value="Id" />
    </SfListBox>
    @code {
        public List<VegetableDetail> VegetableData = new List<VegetableDetail> {
           new VegetableDetail{ Vegetable = "Cabbage", Category = "Leafy and Salad", Id = "item1" },
           new VegetableDetail{ Vegetable = "Spinach", Category = "Leafy and Salad", Id = "item2" },
           new VegetableDetail{ Vegetable = "Chickpea", Category = "Beans", Id = "item6" },
           new VegetableDetail{ Vegetable = "Green bean", Category = "Beans", Id = "item7" },
           new VegetableDetail{ Vegetable = "Garlic", Category = "Bulb and Stem", Id = "item9" },
           new VegetableDetail{ Vegetable = "Nopal", Category = "Bulb and Stem", Id = "item10" }
        };
        public class VegetableDetail {
            public string Vegetable { get; set; }
            public string Category { get; set; }
            public string Id { get; set; }
        }
    }

    HtmlAttributes

    Gets or sets the additional attributes to be applied to the SfListBox<TValue, TItem> container element.

    Declaration
    public string HtmlAttributes { get; set; }
    Property Value
    Type Description
    System.String

    A collection of attributes to be added to the SfListBox<TValue, TItem> container element.

    Remarks

    Additional attributes can be added by specifying as inline attributes or by specifying the @attributes directive.

    IconCss

    Gets or sets a value that indicates a CSS class string to include an icon or image for each list item in a SfListBox<TValue, TItem>.

    Declaration
    public string IconCss { get; set; }
    Property Value
    Type Description
    System.String

    Accepts a CSS class string separated by space to include an icon or image for each list item. The default value is String.Empty.

    Text

    Gets or sets a value that indicates a text for mapping column from data table for each list item in a SfListBox<TValue, TItem>.

    Declaration
    public string Text { get; set; }
    Property Value
    Type Description
    System.String

    Value

    Gets or sets a value that indicates a value for mapping column from data table for each list item in a SfListBox<TValue, TItem>.

    Declaration
    public string Value { get; set; }
    Property Value
    Type Description
    System.String

    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 Description
    System.Threading.Tasks.Task
    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved