Blazor

Upgrade Guide User Guide Demos Support Forums Download
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class SfListBox<TValue, TItem> - Blazor API Reference | Syncfusion

    Show / Hide Table of Contents

    Class SfListBox<TValue, TItem>

    ListBox component used to display a list of items. Users can select one or more items in the list using a checkbox or by keyboard selection. It supports sorting, grouping, reordering and drag and drop of items.

    Inheritance
    System.Object
    Syncfusion.Blazor.SfBaseComponent
    SfDataBoundComponent
    SfDropDownBase<TItem>
    SfListBox<TValue, TItem>
    Inherited Members
    SfDropDownBase<TItem>.Render(IEnumerable<TItem>, FieldSettingsModel, Query)
    SfDropDownBase<TItem>.SetListData(IEnumerable<TItem>, FieldSettingsModel, Query)
    SfDropDownBase<TItem>.SetFields()
    SfDropDownBase<TItem>.SimpleDataExecute(IEnumerable<TItem>, Query)
    SfDropDownBase<TItem>.CloneQuery(Query)
    SfDropDownBase<TItem>.GetDataByText(String)
    SfDropDownBase<TItem>.IncrementalSearch(String, IEnumerable<TItem>, Nullable<Int32>, Boolean)
    SfDropDownBase<TItem>.Search(String, IEnumerable<TItem>, String, Boolean)
    SfDropDownBase<TItem>.SetItemValue(String)
    SfDropDownBase<TItem>.IsSimpleDataType()
    SfDropDownBase<TItem>.AddItem(IEnumerable<TItem>, Nullable<Int32>)
    SfDropDownBase<TItem>.InsertItem(IEnumerable<TItem>, Nullable<Int32>, Boolean)
    SfDropDownBase<TItem>.RenderItems()
    SfDropDownBase<TItem>.HighlightSearch(String, String, Boolean, FilterType)
    SfDropDownBase<TItem>.ListItemCreated(ListOptions<TItem>)
    SfDropDownBase<TItem>.EnablePersistence
    SfDropDownBase<TItem>.ItemTemplate
    SfDropDownBase<TItem>.GroupTemplate
    SfDropDownBase<TItem>.NoRecordsTemplate
    SfDropDownBase<TItem>.ActionFailureTemplate
    SfDropDownBase<TItem>.SortOrder
    SfDropDownBase<TItem>.Enabled
    SfDropDownBase<TItem>.DataSource
    SfDropDownBase<TItem>.Query
    SfDropDownBase<TItem>.FilterType
    SfDropDownBase<TItem>.IgnoreCase
    SfDropDownBase<TItem>.IgnoreAccent
    SfDropDownBase<TItem>.ZIndex
    SfDropDownBase<TItem>.Locale
    SfDropDownBase<TItem>.DropDownsEditContext
    SfDropDownBase<TItem>.ListData
    SfDropDownBase<TItem>.MainData
    SfDropDownBase<TItem>.ListDataSource
    SfDropDownBase<TItem>.ItemData
    SfDropDownBase<TItem>.IsActionFaiure
    SfDropDownBase<TItem>.ComponentName
    SfDataBoundComponent.SetDataManager<T>(Object)
    SfDataBoundComponent.DataManager
    SfDataBoundComponent.MainParent
    Namespace: Syncfusion.Blazor.DropDowns
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class SfListBox<TValue, TItem> : SfDropDownBase<TItem>, IListBox
    Type Parameters
    Name Description
    TValue
    TItem

    Constructors

    SfListBox()

    Declaration
    public SfListBox()

    Properties

    AllowDragAndDrop

    If 'allowDragAndDrop' is set to true, then you can perform drag and drop of the list item. ListBox contains same 'scope' property enables drag and drop between multiple ListBox.

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

    AllowFiltering

    To enable the filtering option in this component. Filter action performs when type in search box and collect the matched item through Filtering event. If searching character does not match, noRecordsTemplate property value will be shown.

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

    CssClass

    Sets the CSS classes to root element of this component, which helps to customize the complete styles.

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

    EnableRtl

    Enable or disable rendering component in right to left direction.

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

    FilterBarPlaceholder

    Accepts the value to be displayed as a watermark text on the filter bar.

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

    Height

    Sets the height of the ListBox component.

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

    HtmlAttributes

    You can add the additional HTML attributes such as id, title etc., to the listbox element.

    Declaration
    public Dictionary<string, object> HtmlAttributes { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.Dictionary<System.String, System.Object>

    ID

    Specifies the id of the ListBox component.

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

    MaximumSelectionLength

    Sets limitation to the value selection. based on the limitation, list selection will be prevented.

    Declaration
    public double MaximumSelectionLength { get; set; }
    Property Value
    Type Description
    System.Double

    Scope

    Defines the connected ListBox reference to group sets of draggable and droppable ListBox. A draggable ListBox with the scope reference will be accepted by the droppable.

    Declaration
    public SfListBox<TValue, TItem> Scope { get; set; }
    Property Value
    Type Description
    SfListBox<TValue, TItem>

    Value

    Sets the specified item to the selected state or gets the selected item in the ListBox.

    Declaration
    public TValue Value { get; set; }
    Property Value
    Type Description
    TValue

    ValueChanged

    Specifies the callback to trigger when the value changes.

    Declaration
    public EventCallback<TValue> ValueChanged { get; set; }
    Property Value
    Type Description
    Microsoft.AspNetCore.Components.EventCallback<TValue>

    ValueExpression

    Specifies the expression for defining the value of the bound.

    Declaration
    public Expression<Func<TValue>> ValueExpression { get; set; }
    Property Value
    Type Description
    System.Linq.Expressions.Expression<System.Func<TValue>>

    Methods

    ActionBegin(IEnumerable<TItem>, Query)

    Declaration
    protected override Task<ActionBeginEventArgs> ActionBegin(IEnumerable<TItem> dataSource, Query query = null)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<TItem> dataSource
    Query query
    Returns
    Type Description
    System.Threading.Tasks.Task<ActionBeginEventArgs>
    Overrides
    Syncfusion.Blazor.DropDowns.SfDropDownBase<TItem>.ActionBegin(System.Collections.Generic.IEnumerable<TItem>, Syncfusion.Blazor.Data.Query)

    ActionComplete(IEnumerable<TItem>, Query)

    Declaration
    protected override Task ActionComplete(IEnumerable<TItem> dataSource, Query query = null)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<TItem> dataSource
    Query query
    Returns
    Type Description
    System.Threading.Tasks.Task
    Overrides
    Syncfusion.Blazor.DropDowns.SfDropDownBase<TItem>.ActionComplete(System.Collections.Generic.IEnumerable<TItem>, Syncfusion.Blazor.Data.Query)

    ActionFailure(Object)

    Declaration
    protected override Task ActionFailure(object args)
    Parameters
    Type Name Description
    System.Object args
    Returns
    Type Description
    System.Threading.Tasks.Task
    Overrides
    Syncfusion.Blazor.DropDowns.SfDropDownBase<TItem>.ActionFailure(System.Object)

    BuildRenderTree(RenderTreeBuilder)

    Declaration
    protected override void BuildRenderTree(RenderTreeBuilder __builder)
    Parameters
    Type Name Description
    Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder

    EnableItems<T>(T, Boolean)

    This method is used to enable or disable the items in the ListBox based on the items and enable argument.

    Declaration
    public void EnableItems<T>(T items, bool enable = true)
    Parameters
    Type Name Description
    T items

    Specifies the list items to be enabled or disabled. You can pass either value(TValue) or data source(TItem) collection.

    System.Boolean enable

    Set false to disable the items. By default the items will be enabled.

    Type Parameters
    Name Description
    T

    Filter(IEnumerable<TItem>, Query, FieldSettingsModel)

    To filter the data from given data source by using query

    Declaration
    public Task Filter(IEnumerable<TItem> dataSource, Query query = null, FieldSettingsModel fields = null)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<TItem> dataSource

    Set the data source to filter.

    Query query

    Specify the query to filter the data.

    FieldSettingsModel fields

    Specify the fields to map the column in the data table.

    Returns
    Type Description
    System.Threading.Tasks.Task

    GetDataByValue(TValue)

    Gets the array of data Object that matches the given array of values.

    Declaration
    public List<TItem> GetDataByValue(TValue dataValue)
    Parameters
    Type Name Description
    TValue dataValue

    Specifies the value(s).

    Returns
    Type Description
    System.Collections.Generic.List<TItem>

    GetDataByValues(Object)

    Gets the array of data Object that matches the given array of values.

    Declaration
    public Task<List<object>> GetDataByValues(object value)
    Parameters
    Type Name Description
    System.Object value

    Specifies the value(s).

    Returns
    Type Description
    System.Threading.Tasks.Task<System.Collections.Generic.List<System.Object>>

    GetDataList()

    Returns the updated dataSource in ListBox

    Declaration
    public IEnumerable<TItem> GetDataList()
    Returns
    Type Description
    System.Collections.Generic.IEnumerable<TItem>

    GetItems()

    Gets all the list items bound on this component.

    Declaration
    public Task<List<DOM>> GetItems()
    Returns
    Type Description
    System.Threading.Tasks.Task<System.Collections.Generic.List<DOM>>

    GetQuery(Query)

    Declaration
    protected override Query GetQuery(Query query)
    Parameters
    Type Name Description
    Query query
    Returns
    Type Description
    Query
    Overrides
    Syncfusion.Blazor.DropDowns.SfDropDownBase<TItem>.GetQuery(Syncfusion.Blazor.Data.Query)

    GetSortedList()

    Returns the sorted Data in ListBox

    Declaration
    public Task<TItem> GetSortedList()
    Returns
    Type Description
    System.Threading.Tasks.Task<TItem>

    IsFilter()

    Declaration
    protected override bool IsFilter()
    Returns
    Type Description
    System.Boolean
    Overrides
    Syncfusion.Blazor.DropDowns.SfDropDownBase<TItem>.IsFilter()

    MoveAllTo(SfListBox<TValue, TItem>, Nullable<Double>)

    Moves all the values from one ListBox to the scoped ListBox.

    Declaration
    public Task MoveAllTo(SfListBox<TValue, TItem> scope = null, Nullable<double> index = null)
    Parameters
    Type Name Description
    SfListBox<TValue, TItem> scope

    Specifies the destination ListBox reference.

    System.Nullable<System.Double> index

    Specifies the index to place the moved items.

    Returns
    Type Description
    System.Threading.Tasks.Task

    MoveDown(TValue)

    Moves the given value(s) / selected value(s) downwards.

    Declaration
    public Task MoveDown(TValue values = null)
    Parameters
    Type Name Description
    TValue values

    Specifies the value(s).

    Returns
    Type Description
    System.Threading.Tasks.Task

    MoveTo(TValue, Nullable<Double>, SfListBox<TValue, TItem>)

    Moves the given value(s) / selected value(s) to the given / default scoped ListBox.

    Declaration
    public Task MoveTo(TValue values = null, Nullable<double> index = null, SfListBox<TValue, TItem> scope = null)
    Parameters
    Type Name Description
    TValue values

    Specifies the value(s).

    System.Nullable<System.Double> index

    Specifies the index to place the moved items.

    SfListBox<TValue, TItem> scope

    Specifies the destination ListBox reference.

    Returns
    Type Description
    System.Threading.Tasks.Task

    MoveUp(TValue)

    Moves the given value(s) / selected value(s) upwards.

    Declaration
    public Task MoveUp(TValue values = null)
    Parameters
    Type Name Description
    TValue values

    Specifies the value(s).

    Returns
    Type Description
    System.Threading.Tasks.Task

    OnAfterRenderAsync(Boolean)

    Declaration
    protected override Task OnAfterRenderAsync(bool firstRender)
    Parameters
    Type Name Description
    System.Boolean firstRender
    Returns
    Type Description
    System.Threading.Tasks.Task
    Overrides
    SfDataBoundComponent.OnAfterRenderAsync(Boolean)

    OnInitializedAsync()

    Declaration
    protected override Task OnInitializedAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task
    Overrides
    Syncfusion.Blazor.DropDowns.SfDropDownBase<TItem>.OnInitializedAsync()

    OnParametersSetAsync()

    Declaration
    protected override Task OnParametersSetAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task
    Overrides
    Syncfusion.Blazor.DropDowns.SfDropDownBase<TItem>.OnParametersSetAsync()

    RemoveItem(IEnumerable<TItem>, Nullable<Int32>)

    Removes a item or collection of items from the list. By default, removed the last item in the list, but you can remove based on the index parameter.

    Declaration
    public Task RemoveItem(IEnumerable<TItem> items = null, Nullable<int> itemIndex = null)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<TItem> items

    Specifies the list of data collection to be removed.

    System.Nullable<System.Int32> itemIndex

    Specifies the index to remove the item from the list.

    Returns
    Type Description
    System.Threading.Tasks.Task

    RemoveItems(Object, Nullable<Double>)

    Removes a item from the list. By default, removed the last item in the list, but you can remove based on the index parameter.

    Declaration
    public Task RemoveItems(object items = null, Nullable<double> itemIndex = null)
    Parameters
    Type Name Description
    System.Object items

    Specifies the list of data collection to be removed.

    System.Nullable<System.Double> itemIndex

    Specifies the index to remove the item from the list.

    Returns
    Type Description
    System.Threading.Tasks.Task

    RequiredModules()

    Gets the required modules.

    Declaration
    public Task<List<object>> RequiredModules()
    Returns
    Type Description
    System.Threading.Tasks.Task<System.Collections.Generic.List<System.Object>>

    SelectAll(Boolean)

    Based on the state parameter, entire list item will be selected/deselected.

    Declaration
    public Task SelectAll(bool state = true)
    Parameters
    Type Name Description
    System.Boolean state

    Set true/false to select/ unselect the entire list items.

    Returns
    Type Description
    System.Threading.Tasks.Task

    SelectItems<T>(T, Boolean)

    Based on the state parameter, specified list item will be selected/deselected.

    Declaration
    public Task SelectItems<T>(T items, bool state = true)
    Parameters
    Type Name Description
    T items

    Specifies the list items to be selected or unselected. You can pass either value(TValue) or data source(TItem) collection.

    System.Boolean state

    Set false to un select the items. By default the items will be selected.

    Returns
    Type Description
    System.Threading.Tasks.Task
    Type Parameters
    Name Description
    T
    Back to top Generated by DocFX
    Copyright © 2001 - 2021 Syncfusion Inc. All Rights Reserved