Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class SfListBox<TValue, TItem>

    Show / Hide Table of Contents

    Class SfListBox<TValue, TItem>

    The ListBox component displays a list of items and allows users to select one or more items using a checkbox or keyboard selection. It includes features such as sorting, grouping, reordering, and drag-and-drop functionality for items.

    Inheritance
    System.Object
    SfBaseComponent
    SfDataBoundComponent
    SfDropDownBase<TItem>
    SfListBox<TValue, TItem>
    Inherited Members
    Syncfusion.Blazor.DropDowns.SfDropDownBase<TItem>.RenderListItemsAsync(System.Collections.Generic.IEnumerable<TItem>, Syncfusion.Blazor.DropDowns.FieldSettingsModel, Syncfusion.Blazor.Data.Query)
    Syncfusion.Blazor.DropDowns.SfDropDownBase<TItem>.SetListDataAsync(System.Collections.Generic.IEnumerable<TItem>, Syncfusion.Blazor.DropDowns.FieldSettingsModel, Syncfusion.Blazor.Data.Query)
    Syncfusion.Blazor.DropDowns.SfDropDownBase<TItem>.GetPropertyValue(System.Object, System.String)
    SfDropDownBase<TItem>.SetFields()
    SfDropDownBase<TItem>.ExecuteSimpleQuery(IEnumerable<TItem>, Query)
    SfDropDownBase<TItem>.CloneQuery(Query)
    Syncfusion.Blazor.DropDowns.SfDropDownBase<TItem>.GetDataByText(System.String, System.String)
    Syncfusion.Blazor.DropDowns.SfDropDownBase<TItem>.IncrementalSearch(System.String, System.Collections.Generic.IEnumerable<TItem>, System.Nullable<System.Int32>, System.Boolean)
    Syncfusion.Blazor.DropDowns.SfDropDownBase<TItem>.Search(System.String, System.Collections.Generic.IEnumerable<TItem>, System.String, System.Boolean)
    SfDropDownBase<TItem>.SetItemValue(String, Type)
    SfDropDownBase<TItem>.IsPrimitiveDataType()
    Syncfusion.Blazor.DropDowns.SfDropDownBase<TItem>.AddItems(System.Collections.Generic.IEnumerable<TItem>, System.Nullable<System.Int32>)
    SfDropDownBase<TItem>.AddItemsAsync(IEnumerable<TItem>, Nullable<Int32>)
    SfDropDownBase<TItem>.InsertItemAsync(IEnumerable<TItem>, Nullable<Int32>, Boolean)
    Syncfusion.Blazor.DropDowns.SfDropDownBase<TItem>.RenderItemsAsync(System.Collections.Generic.IEnumerable<TItem>)
    SfDropDownBase<TItem>.GetGroupedDataSourceAsync(IEnumerable<TItem>, SortOrder)
    Syncfusion.Blazor.DropDowns.SfDropDownBase<TItem>.HighlightSearch(System.String, System.String, System.Boolean, Syncfusion.Blazor.DropDowns.FilterType)
    SfDropDownBase<TItem>.ListItemCreated(ListOptions<TItem>)
    SfDropDownBase<TItem>.reflectionHelper
    Syncfusion.Blazor.DropDowns.SfDropDownBase<TItem>.ListData
    Syncfusion.Blazor.DropDowns.SfDropDownBase<TItem>.MainData
    Syncfusion.Blazor.DropDowns.SfDropDownBase<TItem>.ListDataSource
    Syncfusion.Blazor.DropDowns.SfDropDownBase<TItem>.DataId
    Syncfusion.Blazor.DropDowns.SfDropDownBase<TItem>.ItemData
    Syncfusion.Blazor.DropDowns.SfDropDownBase<TItem>.IsActionFailed
    Syncfusion.Blazor.DropDowns.SfDropDownBase<TItem>.TotalCount
    SfDropDownBase<TItem>.ItemTemplate
    SfDropDownBase<TItem>.GroupTemplate
    SfDropDownBase<TItem>.NoRecordsTemplate
    SfDropDownBase<TItem>.ActionFailureTemplate
    SfDropDownBase<TItem>.SortOrder
    SfDropDownBase<TItem>.DataSource
    SfDropDownBase<TItem>.Query
    SfDropDownBase<TItem>.DuplicateQuery
    SfDropDownBase<TItem>.FilterType
    SfDropDownBase<TItem>.IgnoreCase
    SfDropDownBase<TItem>.IgnoreAccent
    SfDropDownBase<TItem>.ZIndex
    SfDropDownBase<TItem>.DropDownsEditContext
    SfDataBoundComponent.SetDataManager<T>(Object)
    SfDataBoundComponent.DataManager
    SfDataBoundComponent.MainParent
    SfBaseComponent.Dispose()
    SfBaseComponent.OnObservableChange(String, Object, Boolean, NotifyCollectionChangedEventArgs)
    Namespace: Syncfusion.Blazor.DropDowns
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class SfListBox<TValue, TItem> : SfDropDownBase<TItem>, IListBox
    Type Parameters
    Name Description
    TValue

    The type of the value returned by the selected item.

    TItem

    The type of the items in the ListBox.

    Examples

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

    <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; }
         }
    }

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

    <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; }
         }
    }

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

    <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; }
         }
    }

    The below code example, showcases a basic SfListBox<TValue, TItem>.

    <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"}
        }
    }

    The below code example, showcases a ListBox component.

    <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

    SfListBox()

    Declaration
    public SfListBox()

    Properties

    AllowDragAndDrop

    Gets or sets a value indicating whether drag-and-drop functionality is allowed in the SfListBox<TValue, TItem>.

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

    true if drag-and-drop functionality is allowed; otherwise, false. The default value is false.

    Remarks

    The Scope property is used to perform drag and drop between different SfListBox<TValue, TItem>.

    AllowFiltering

    Gets or sets a value indicating whether filtering is allowed in the SfListBox<TValue, TItem>.

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

    true if filtering is allowed; otherwise, false. The default value is false.

    Remarks

    The FilterBarPlaceholder property is used to show placeholder on the filter bar.

    ComponentName

    Declaration
    protected override string ComponentName { get; set; }
    Property Value
    Type Description
    System.String
    Overrides
    Syncfusion.Blazor.DropDowns.SfDropDownBase<TItem>.ComponentName

    CssClass

    Gets or sets the class/multiple classes separated by a space for the SfListBox<TValue, TItem> component.

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

    The CSS class string to customize the appearance of the SfListBox<TValue, TItem>. The default value is an empty string.

    Enabled

    Gets or sets a value indicating whether the SfListBox<TValue, TItem> is enabled to interact with it.

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

    true if the control is enabled; otherwise, false. The default value is true.

    EnablePersistence

    Gets or sets a value indicating whether the component's state should be persisted across postbacks.

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

    true if the component's state should be persisted; otherwise, false. The default value is false.

    Remarks

    The Value property is used to persist the component's state.

    EnableRtl

    Gets or sets a value indicating whether the control should display in Right-to-Left (RTL) direction.

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

    true if the control should display in RTL direction; otherwise, false. The default value is false.

    FilterBarPlaceholder

    Gets or sets the placeholder text for the filter bar in the SfListBox<TValue, TItem>.

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

    The string value that represents the placeholder text for the filter bar in the SfListBox<TValue, TItem>. The default value is an empty string.

    Remarks

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

    Examples

    The below code example, showcases a filter bar place holder support in the SfListBox<TValue, TItem>.

    <SfListBox Value="@value" DataSource="@vehicleData" AllowFiltering="True" FilterBarPlaceHolder="Enter a string to filter" 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; }
         }
    }

    Height

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

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

    A string value that represents the height of the SfListBox<TValue, TItem>. The default value is "". If the value is not specified, then the height will be calculated based on the entire list item's height.

    Remarks

    To add the suffix 'px' to the value if the height is fixed, for instance, '200px'. To add the suffix '%' to the value if the height is responsive, for instance, '200%'.

    HtmlAttributes

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

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

    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.

    MaximumSelectionLength

    Gets or sets the maximum length of items that can be selected in the SfListBox<TValue, TItem>.

    Declaration
    public int MaximumSelectionLength { get; set; }
    Property Value
    Type Description
    System.Int32

    An integer value that represents the maximum selection length. The default value is 500.

    Remarks

    Based on the limitation, list selection will be prevented.

    Scope

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

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

    A string value that represents the scope of the SfListBox<TValue, TItem>.

    Remarks

    The drag and drop operation and the toolbar interactions performed based on the Scope value. The AllowDragAndDrop and ListBoxToolbarSettings is used to enable drag and drop as well as toolbar interactions in the SfListBox<TValue, TItem>.

    Examples

    The below code example, showcases drag and drop support with scope property in the SfListBox<TValue, TItem>.

    <SfListBox Scope="@scope" AllowDragAndDrop="true" DataSource="@vehicleData1" TValue="string[]" TItem="ListItem">
        <ListBoxFieldSettings Text="Text" Value="ID"></ListBoxFieldSettings>
        <ListBoxToolbarSettings Items="@items"></ListBoxToolbarSettings>
    </SfListBox>
    <SfListBox Scope="@scope" AllowDragAndDrop="true" DataSource="@vehicleData2" TValue="string[]" TItem="ListItem">
        <ListBoxFieldSettings Text="Text" Value="ID"></ListBoxFieldSettings>
    </SfListBox>
    @code{
        private string scope= "combined-list";
        private string[] items = new string[] { "MoveUp", "MoveDown", "MoveTo", "MoveFrom", "MoveAllTo", "MoveAllFrom" };
        private List<ListItem> vehicleData1 = 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"}
        }
        private List<ListItem> vehicleData2 = new List<ListItem>{
            new ListItem { Text = "SSC Ultimate Aero", ID = "List-04" },
            new ListItem { Text = "Koenigsegg CCR", ID = "List-05" },
            new ListItem { Text = "McLaren F1", ID = "List-06" }
        }
        public class ListItem
        {
            public string Text { get; set; }
            public string ID { get; set; }
         }
    }

    Value

    Gets or sets a value that indicates the selected items in the SfListBox<TValue, TItem>.

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

    ValueChanged

    An event callback that is triggered when the value of the component changes.

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

    By using this event and the ValueExpression property, two-way binding can be achieved instead of using @bind-Value.

    Examples

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

    <SfListBox ValueExpression="@(() => value )" ValueChanged="@((string[] v) => value = v)" 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; }
         }
    }

    ValueExpression

    Gets or sets a lambda expression that identifies the bound value of Value property.

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

    The lambda expression that identifies the value bound to the Value property.

    Remarks

    By using this property and the ValueChanged event, two-way binding can be achieved instead of using @bind-Value.

    Examples

    The below code example, showcases a basic SfListBox<TValue, TItem>.

    <SfListBox ValueExpression="@(() => value )" ValueChanged="@((string[] v) => value = v)" 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; }
         }
    }

    Methods

    ActionBeginAsync(IEnumerable<TItem>, Query)

    Declaration
    protected override Task<ActionBeginEventArgs> ActionBeginAsync(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>.ActionBeginAsync(System.Collections.Generic.IEnumerable<TItem>, Syncfusion.Blazor.Data.Query)

    ActionCompleteAsync(IEnumerable<TItem>, Query)

    Declaration
    protected override Task ActionCompleteAsync(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>.ActionCompleteAsync(System.Collections.Generic.IEnumerable<TItem>, Syncfusion.Blazor.Data.Query)

    ActionFailureAsync(Object)

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

    BuildRenderTree(RenderTreeBuilder)

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

    Dispose(Boolean)

    Declaration
    protected override void Dispose(bool disposing)
    Parameters
    Type Name Description
    System.Boolean disposing
    Overrides
    Syncfusion.Blazor.DropDowns.SfDropDownBase<TItem>.Dispose(System.Boolean)

    EnableItems<T>(T, Boolean)

    Enables or disables an item or collection of items based on the specified items and the enable parameter in the SfListBox<TValue, TItem>.

    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

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

    Type Parameters
    Name Description
    T
    Examples

    The below code example, showcases a EnableItems method to enable / disable the list items.

    <SfListBox @ref="ListBoxObj" Value="@value" DataSource="@vehicleData" TValue="string[]" TItem="ListItem">
        <ListBoxFieldSettings Text="Text" Value="ID"></ListBoxFieldSettings>
        <ListBoxEvents TValue="string[]" Created="created"></ListBoxEvents>
    </SfListBox>
    @code{
        SfListBox<string[],ListItem> ListBoxObj;
        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 string[] Value = new string[] { "Bugatti Chiron" };
        private void created()
        {
             ListBoxObj.EnableItems(Value, false);
        }
        public class ListItem
        {
            public string Text { get; set; }
            public string ID { get; set; }
         }
    }

    GetDataByValue(TValue)

    Gets an item or a collection of items with type of 'TItem' that matches the specific list of values such as string[], int[] etc.

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

    Specifies the value(s) such as string[], int[] etc.

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

    The list of items with the type of 'TItem'.

    GetDataList()

    Gets the collection of list items bound to the SfListBox<TValue, TItem>.

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

    The list of items with the type of 'TItem'.

    GetPersistData()

    Declaration
    protected Task<string> GetPersistData()
    Returns
    Type Description
    System.Threading.Tasks.Task<System.String>

    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)

    IsFilterMode()

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

    MoveAllAsync(String, Nullable<Int32>)

    Moves all the items from source SfListBox<TValue, TItem> to the destination SfListBox<TValue, TItem>.

    Declaration
    public Task MoveAllAsync(string scope = null, Nullable<int> index = null)
    Parameters
    Type Name Description
    System.String scope

    Specifies the scope used to identify the destination SfListBox<TValue, TItem> for the move operation.

    System.Nullable<System.Int32> index

    Specifies the index of the location where the moved items should be placed.

    Returns
    Type Description
    System.Threading.Tasks.Task

    A Task that represents the asynchronous operation of moving all the items. It completes when the component has finished the action.

    MoveAsync(TValue, Nullable<Int32>, String)

    Moves an item or the collection of items based on the specified value(s) to the destination SfListBox<TValue, TItem>.

    Declaration
    public Task MoveAsync(TValue values = null, Nullable<int> index = null, string scope = null)
    Parameters
    Type Name Description
    TValue values

    Specifies the value(s) to move the list of items upwards.

    System.Nullable<System.Int32> index

    Specifies the index of the location where the moved items should be placed.

    System.String scope

    Specifies the scope used to identify the destination SfListBox<TValue, TItem> for the move operation.

    Returns
    Type Description
    System.Threading.Tasks.Task

    A Task that represents the asynchronous operation of moving the items upwards. It completes when the component has finished the action.

    MoveDownAsync(TValue)

    Moves an item or the collection of items based on the specified value(s) to downwards in the current SfListBox<TValue, TItem>.

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

    Specifies the value(s) to move the list of items downwards.

    Returns
    Type Description
    System.Threading.Tasks.Task

    A Task that represents the asynchronous operation of moving items downwards. It completes when the component has finished the action.

    MoveUpAsync(TValue)

    Moves an item or the collection of items based on the specified value(s) to upwards in the current SfListBox<TValue, TItem>.

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

    Specifies the value(s) to move the list of items upwards.

    Returns
    Type Description
    System.Threading.Tasks.Task

    A Task that represents the asynchronous operation of moving the items upwards. It completes when the component has finished the action.

    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()

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

    Removes an item or collection of items from the listbox base on the given items. By default, it removes the last item, but you can also removes the item based on the index parameter.

    Declaration
    public Task RemoveItemAsync(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

    A Task that represents the asynchronous operation of removing the items. It completes when the component has finished the action.

    SelectAllAsync(Boolean)

    Selects or deselects the entire collection of items of the SfListBox<TValue, TItem> based on the state parameter.

    Declaration
    public Task SelectAllAsync(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

    A Task that represents the asynchronous operation of selecting all the items. It completes when the component has finished the action.

    SelectItemsAsync<T>(T, Boolean)

    Selects or deselects the specific collection of items based on the given value(s) and the state parameters.

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

    Specifies the collection 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

    A Task that represents the asynchronous operation of selecting the items. It completes when the component has finished the action.

    Type Parameters
    Name Description
    T
    Examples

    The below code example, showcases a SelectItemsAsync method.

    <SfListBox @ref="ListBoxObj" Value="@value" DataSource="@vehicleData" TValue="string[]" TItem="ListItem">
        <ListBoxFieldSettings Text="Text" Value="ID"></ListBoxFieldSettings>
        <ListBoxEvents TValue="string[]" Created="created"></ListBoxEvents>
    </SfListBox>
    @code{
        SfListBox<string[],ListItem> ListBoxObj;
        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 string[] Value = new string[] { "Bugatti Chiron" };
        private async Task created(object args)
        {
             await ListBoxObj.SelectItemsAsync(Value, true);
        }
        public class ListItem
        {
            public string Text { get; set; }
            public string ID { get; set; }
         }
    }

    SetLocalStorage(String, List<String>)

    Declaration
    protected Task SetLocalStorage(string persistId, List<string> values)
    Parameters
    Type Name Description
    System.String persistId
    System.Collections.Generic.List<System.String> values
    Returns
    Type Description
    System.Threading.Tasks.Task
    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved