Class ListBoxModel<T>
Represents configuration and events for the Syncfusion ListBox component. Exposes properties for data-binding, filtering, drag-and-drop, selection, and customization, as well as event callbacks for all critical ListBox lifecycle events.
Inheritance
Namespace: Syncfusion.Blazor.DropDowns
Assembly: Syncfusion.Blazor.dll
Syntax
public class ListBoxModel<T> : Object
Type Parameters
Name |
---|
T |
Remarks
Use ListBoxModel and its event callbacks to tailor ListBox behavior, appearance, and interaction patterns for your application's needs.
Examples
<SfListBox TItem="ListBoxData" TValue="string" DataSource="@MyList" AllowFiltering="true" MaximumSelectionLength="3">
<ListBoxEvents OnChange="OnSelectionChanged" />
</SfListBox>
Constructors
ListBoxModel()
Declaration
public ListBoxModel()
Properties
ActionBegin
Event data when remote data fetch is initiated for the ListBox component.
Declaration
public ActionBeginEventArgs ActionBegin { get; set; }
Property Value
Type | Description |
---|---|
ActionBeginEventArgs | An |
ActionComplete
Event data for when remote data fetching completes successfully.
Declaration
public ActionCompleteEventArgs ActionComplete { get; set; }
Property Value
Type | Description |
---|---|
ActionCompleteEventArgs | An |
ActionFailure
Callback triggered when a remote fetch request fails.
Declaration
public EventCallback<object> ActionFailure { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<System.Object> | Use |
AllowDragAndDrop
If true, enables drag-and-drop of ListBox items. Items can be moved within a list and between lists with the same scope
.
Declaration
public bool AllowDragAndDrop { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
AllowFiltering
If true, enables the input filter search box for the ListBox component.
Declaration
public bool AllowFiltering { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
When enabled, typing in the filter box triggers the Filtering
event. If no results match, noRecordsTemplate
is shown.
BeforeDrop
Callback raised before dragging/dropping an item onto another.
Declaration
public EventCallback<object> BeforeDrop { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<System.Object> | Event fired before drop event. Useful for canceling or preparing custom operations. |
BeforeItemRender
Callback triggered while each item is rendered. Use to apply custom logic or classes per item.
Declaration
public EventCallback<object> BeforeItemRender { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.EventCallback<System.Object> |
Change
Callback triggered on selection or deselection of list items.
Declaration
public EventCallback<object> Change { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.EventCallback<System.Object> |
Remarks
Listen to this event for model updates or further item actions on select/deselect.
Created
Callback triggered when the ListBox component is initialized and ready.
Declaration
public EventCallback<object> Created { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.EventCallback<System.Object> |
CssClass
CSS class or classes for customizing the ListBox root element style.
Declaration
public string CssClass { get; set; }
Property Value
Type | Description |
---|---|
System.String | Use any valid CSS string for theming. |
Destroyed
Callback when the component is disposed or destroyed. Use for cleanup or analytics.
Declaration
public EventCallback<object> Destroyed { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.EventCallback<System.Object> |
Drag
Callback triggered while the component's item is being dragged.
Declaration
public EventCallback<object> Drag { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.EventCallback<System.Object> |
DragStart
Callback triggered after dragging the list item operation completes.
Declaration
public EventCallback<object> DragStart { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.EventCallback<System.Object> |
Drop
Callback after a drop operation completes, for custom logic post-drop between ListBoxes.
Declaration
public EventCallback<object> Drop { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.EventCallback<System.Object> |
EnableRtl
Set to true
to enable RTL (right-to-left) rendering for ListBox content.
Declaration
public bool EnableRtl { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | Enable RTL by setting |
Filtering
Callback during filter input typing in the ListBox.
Declaration
public EventCallback<object> Filtering { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.EventCallback<System.Object> |
Remarks
Use for providing dynamic or server-side filtering as user types.
Height
Height specification for the ListBox component. Use pixel, %, or CSS units.
Declaration
public object Height { get; set; }
Property Value
Type | Description |
---|---|
System.Object | Height as object (string/CSS value/number). |
MaximumSelectionLength
Set the maximum number of items that may be selected by the user.
Declaration
public double MaximumSelectionLength { get; set; }
Property Value
Type | Description |
---|---|
System.Double | Defaults to 1000. |
Remarks
After reaching this limit, additional selection is blocked.
Scope
Value used for grouping ListBoxes for cross-list drag-and-drop. ListBoxes with the same Scope
allow moving items between each other.
Declaration
public string Scope { get; set; }
Property Value
Type | Description |
---|---|
System.String | Defaults to empty string. |
SelectionSettings
Selection options including mode (single/multiple) and checkbox controls.
Declaration
public SelectionSettingsModel SelectionSettings { get; set; }
Property Value
Type | Description |
---|---|
SelectionSettingsModel | A |
ToolbarSettings
Toolbar options for ListBox dual-list tools (move up/down/all, etc) and toolbar position.
Declaration
public ToolbarSettingsModel ToolbarSettings { get; set; }
Property Value
Type | Description |
---|---|
ToolbarSettingsModel | A |
Value
Gets or sets or returns the current value or selected state in the ListBox.
Declaration
public T Value { get; set; }
Property Value
Type | Description |
---|---|
T | The value type parameter T specifying the ListBox’s selected item(s). |