Class ListBoxSelectionSettings
Configures the selection options for a SfListBox<TValue, TItem>, mapping checkbox position, selection mode, and select-all behaviors.
Inheritance
Namespace: Syncfusion.Blazor.DropDowns
Assembly: Syncfusion.Blazor.dll
Syntax
public class ListBoxSelectionSettings : OwningComponentBase
Remarks
Use this class to define how users interact with selection features in a ListBox—such as enabling checkboxes, placing them, or choosing between single and multiple selection modes.
Examples
This example shows configuring a ListBox with selection settings for single selection:
<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[] { "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 the placement of the checkbox within each list item.
Declaration
public CheckBoxPosition CheckboxPosition { get; set; }
Property Value
Type | Description |
---|---|
CheckBoxPosition | One of the CheckBoxPosition enumeration values: |
Remarks
If Left
is set, the checkbox displays to the left of the item's label; if Right
, it displays to the right.
Mode
Gets or sets the mode of selection supported (single or multiple selection) for the ListBox.
Declaration
public SelectionMode Mode { get; set; }
Property Value
Type | Description |
---|---|
SelectionMode | The SelectionMode: |
Remarks
Single
: Only one list item can be selected at a time.Multiple
: Multiple list items can be selected at once.
ShowCheckbox
Enables or disables the display of the selection checkbox for each ListBox item.
Declaration
public bool ShowCheckbox { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
If enabled, checkboxes are rendered next to each item for easy multi-selection. This property is commonly turned on for list selection scenarios.
ShowSelectAll
Enables or disables the "Select All" checkbox option in the ListBox.
Declaration
public bool ShowSelectAll { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
Note: The select-all checkbox is only available when ShowCheckbox
is set to true
—otherwise, this property has no effect.
Examples
This example shows enabling checkboxes and the select-all option:
<SfListBox Value="@value" DataSource="@vehicleData" TValue="string[]" TItem="ListItem">
<ListBoxFieldSettings Text="Text" Value="ID"></ListBoxFieldSettings>
<ListBoxSelectionSettings ShowCheckbox="true" ShowSelectAll="true"></ListBoxSelectionSettings>
</SfListBox>
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 |