menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class ListBoxSelectionSettings - API Reference

    Show / Hide Table of Contents

    Class ListBoxSelectionSettings

    Specifies the selection settings such as CheckboxPosition, Mode, ShowCheckBox, and ShowSelectAll in the SfListBox<TValue, TItem>.

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

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

    <SfListBox Value="@value" DataSource="@vehicleData" TValue="string[]" TItem="ListItem">
        <ListBoxFieldSettings Text="Text" Value="ID"></ListBoxFieldSettings>
        <ListBoxSelectionSettings Mode="Syncfusion.Blazor.DropDowns.SelectionMode.Single"></ListBoxSelectionSettings>
    </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

    ListBoxSelectionSettings()

    Declaration
    public ListBoxSelectionSettings()

    Properties

    CheckboxPosition

    Gets or sets a value that indicates the position of a checkbox in the SfListBox<TValue, TItem>.

    Declaration
    public CheckBoxPosition CheckboxPosition { get; set; }
    Property Value
    Type Description
    CheckBoxPosition

    One of the CheckBoxPosition enumeration. The default value is Left.

    Remarks

    If the CheckBoxPosition is Left, the checkbox will be placed left to the content of the list item. If the CheckBoxPosition is Right, the checkbox will be placed right to the content of the list item.

    Mode

    Gets or sets a value that indicates the mode of selection in the SfListBox<TValue, TItem>.

    Declaration
    public SelectionMode Mode { get; set; }
    Property Value
    Type Description
    SelectionMode

    One of the SelectionMode enumeration. The default value is Multiple.

    Remarks

    If the SelectionMode is Single, allows single selection. If the SelectionMode is Multiple, alloes multiple selection.

    ShowCheckbox

    Gets or sets a value that indicates whether to enable or disable the checkbox selection in SfListBox<TValue, TItem>.

    Declaration
    public bool ShowCheckbox { get; set; }
    Property Value
    Type Description
    System.Boolean

    true, if the checkbox selection is enabled for SfListBox<TValue, TItem>. The default value is false.

    ShowSelectAll

    Gets or sets a value that indicates whether to enable or disable the select all option in SfListBox<TValue, TItem>.

    Declaration
    public bool ShowSelectAll { get; set; }
    Property Value
    Type Description
    System.Boolean

    true, if the select all checkbox option is enabled for SfListBox<TValue, TItem>. The default value is false.

    Remarks

    This property will take into effect once the ShowCheckBox property is true.

    Examples

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

    <SfListBox Value="@value" DataSource="@vehicleData" TValue="string[]" TItem="ListItem">
        <ListBoxFieldSettings Text="Text" Value="ID"></ListBoxFieldSettings>
        <ListBoxSelectionSettings ShowCheckBox="true" ShowSelectAll="true"></ListBoxSelectionSettings>
    </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; }
         }
    }

    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