menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class SfDropDownBase<T> - Blazor API Reference | Syncfusion

    Show / Hide Table of Contents

    Class SfDropDownBase<T>

    Base class for dropdown components, enabling data binding and list item rendering from local or remote data sources.

    Inheritance
    System.Object
    SfBaseComponent
    SfDataBoundComponent
    SfDropDownBase<T>
    SfDropDownList<TValue, TItem>
    SfListBox<TValue, TItem>
    SfMention<TItem>
    SfMultiSelect<TValue, TItem>
    Inherited Members
    SfBaseComponent.Dispose()
    SfBaseComponent.GetEffectivePlatform()
    SfBaseComponent.GetMainComponentPlatform()
    SfBaseComponent.IsMainLicenseComponent()
    SfBaseComponent.LicenseContext
    SfBaseComponent.OnObservableChange(String, Object, Boolean, NotifyCollectionChangedEventArgs)
    SfBaseComponent.ValidateLicense()
    SfDataBoundComponent.DataManager
    SfDataBoundComponent.MainParent
    SfDataBoundComponent.OnAfterRenderAsync(Boolean)
    SfDataBoundComponent.OnInitializedAsync()
    SfDataBoundComponent.OnParametersSetAsync()
    SfDataBoundComponent.SetDataManager<T>(Object)
    Namespace: Syncfusion.Blazor.DropDowns
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class SfDropDownBase<T> : SfDataBoundComponent
    Type Parameters
    Name Description
    T

    The type of data items bound to the dropdown.

    Remarks

    The SfDropDownBase<T> class provides core functionality for dropdown components, supporting data binding, filtering, sorting, virtualization, and templating for list items, group headers, and error states.

    Examples

    Example of binding data to a dropdown:

    <SfDropDownList TValue="string" TItem="string" DataSource="@data">
    </SfDropDownList>
    @code {
        private List<string> data = new List<string> { "Item1", "Item2", "Item3" };
    }

    Example of binding data to a dropdown:

    <SfDropDownList TValue="string" TItem="string" DataSource="@data" Query="@query">
    </SfDropDownList>
    @code {
        private List<string> data = new List<string> { "Item1", "Item2", "Item3" };
        private Query query = new Query().Take(10);
    }

    Constructors

    SfDropDownBase()

    Declaration
    public SfDropDownBase()

    Properties

    ActionFailureTemplate

    Gets or sets the template displayed when a data fetch request fails.

    Declaration
    public RenderFragment ActionFailureTemplate { get; set; }
    Property Value
    Type Description
    Microsoft.AspNetCore.Components.RenderFragment

    A Microsoft.AspNetCore.Components.RenderFragment representing the action failure template. The default value is null.

    Remarks

    This property customizes the content shown in the dropdown's popup when a remote data fetch fails, such as when using a DataManager. If not set, a default error message is displayed.

    Examples

    Example of an action failure template:

    <SfDropDownList TValue="string" TItem="string">
        <DropDownsTemplates>
            <ActionFailureTemplate>
                <div>Data fetch failed</div>
            </ActionFailureTemplate>
        </DropDownsTemplates>
    </SfDropDownList>

    DataSource

    Gets or sets the data source for the dropdown component.

    Declaration
    public IEnumerable<T> DataSource { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.IEnumerable<T>

    An System.Collections.Generic.IEnumerable<> representing the data source, or an instance of DataManager. The default value is null.

    Remarks

    This property binds data to the dropdown, either as a local collection of JSON objects or through a remote DataManager. The data is used to populate the popup list.

    Examples

    Example of binding a data source:

    <SfDropDownList TValue="string" TItem="string" DataSource="@data">
    </SfDropDownList>
    @code {
        private List<string> data = new List<string> { "Item1", "Item2", "Item3" };
    }

    DropDownsEditContext

    Gets or sets the edit context of dropdown base.

    Declaration
    protected EditContext DropDownsEditContext { get; set; }
    Property Value
    Type
    Microsoft.AspNetCore.Components.Forms.EditContext

    DuplicateQuery

    Declaration
    protected Query DuplicateQuery { get; set; }
    Property Value
    Type
    Query

    FilterDataSource

    Gets or sets the filtered data source for the dropdown.

    Declaration
    protected IEnumerable<T> FilterDataSource { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.IEnumerable<T>

    An IEnumerable<T> containing the filtered data source. The default value is null.

    Remarks

    This property holds the data source after applying filtering, used to display filtered results in the dropdown.

    FilterQuery

    Gets or sets the query used for filtering the data source.

    Declaration
    protected Query FilterQuery { get; set; }
    Property Value
    Type Description
    Query

    A Query object used for filtering. The default value is a new instance of Query.

    Remarks

    This property defines the query applied during filtering operations, typically used with FilterDataSource.

    FilterType

    Gets or sets the filter type used for searching the dropdown's list items.

    Declaration
    public virtual FilterType FilterType { get; set; }
    Property Value
    Type Description
    FilterType

    A FilterType value specifying the filter mode. The default value is StartsWith.

    Remarks

    This property determines how search queries are matched against list items, supporting modes like StartsWith, Contains, or EndsWith.

    Examples

    Example of setting the filter type:

    <SfDropDownList TValue="string" TItem="string" FilterType="FilterType.Contains" DataSource="@data">
    </SfDropDownList>
    @code {
        private List<string> data = new List<string> { "Apple", "Banana", "Cherry" };
    }

    GeneratedData

    Gets or sets the dictionary of generated data for virtualization.

    Declaration
    protected Dictionary<int, IEnumerable<object>> GeneratedData { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.Dictionary<System.Int32, System.Collections.Generic.IEnumerable<System.Object>>

    A Dictionary<int, IEnumerable<object>> containing generated data for virtualization. The default value is an empty dictionary.

    Remarks

    This property caches generated data for virtualization to improve performance by reducing redundant data fetching.

    GroupTemplate

    Gets or sets the template for rendering group headers in the dropdown's popup list.

    Declaration
    public RenderFragment<ComposedItemModel<T>> GroupTemplate { get; set; }
    Property Value
    Type Description
    Microsoft.AspNetCore.Components.RenderFragment<Syncfusion.Blazor.DropDowns.ComposedItemModel<T>>

    A RenderFragment<ComposedItemModel<T>> representing the group header template. The default value is null.

    Remarks

    This property customizes the appearance of group headers when the dropdown list is grouped using the GroupBy property. The template receives a ComposedItemModel<T> context.

    Examples

    Example of a group header template:

    <SfDropDownList TValue="string" TItem="MyData">
        <DropDownsTemplates>
            <GroupTemplate>
                <div>@context.Key</div>
            </GroupTemplate>
        </DropDownsTemplates>
    </SfDropDownList>
    @code {
        public class MyData { public string Name { get; set; } public string Category { get; set; } }
    }

    IgnoreAccent

    Gets or sets a value indicating whether diacritic characters are ignored during filtering.

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

    A boolean value where true ignores diacritic characters, and false considers them. The default value is false.

    Remarks

    This property allows filtering to ignore diacritic marks (e.g., accents) when searching for suggestions, improving flexibility for international text.

    Examples

    Example of ignoring diacritics:

    <SfDropDownList TValue="string" TItem="string" IgnoreAccent="true" DataSource="@data">
    </SfDropDownList>
    @code {
        private List<string> data = new List<string> { "Café", "Cafe", "Coffee" };
    }

    IgnoreCase

    Gets or sets a value indicating whether case sensitivity is ignored during filtering.

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

    A boolean value where true ignores case sensitivity during filtering, and false considers case. The default value is true.

    Remarks

    This property controls whether searches in the dropdown are case-sensitive. When set to true, searches match items regardless of letter case.

    Examples

    Example of ignoring case sensitivity:

    <SfDropDownList TValue="string" TItem="string" IgnoreCase="true" DataSource="@data">
    </SfDropDownList>
    @code {
        private List<string> data = new List<string> { "Apple", "banana", "Cherry" };
    }

    IncrementalEndIndex

    Gets or sets the end index for incremental search.

    Declaration
    protected int IncrementalEndIndex { get; set; }
    Property Value
    Type Description
    System.Int32

    An integer representing the end index for incremental search. The default value is 0.

    Remarks

    This property defines the range of items considered during incremental search operations.

    IncrementalSearchIndex

    Gets or sets the index of the currently focused item during incremental search.

    Declaration
    protected int IncrementalSearchIndex { get; set; }
    Property Value
    Type Description
    System.Int32

    An integer representing the index of the focused item. The default value is -1.

    Remarks

    This property tracks the index of the item highlighted during incremental search operations.

    IncrementalStartIndex

    Gets or sets the start index for incremental search.

    Declaration
    protected int IncrementalStartIndex { get; set; }
    Property Value
    Type Description
    System.Int32

    An integer representing the start index for incremental search. The default value is 0.

    Remarks

    This property defines the starting point for incremental search operations within the data source.

    IsCustomFilteringAction

    Gets or sets a value indicating whether custom filtering is active.

    Declaration
    protected bool IsCustomFilteringAction { get; set; }
    Property Value
    Type Description
    System.Boolean

    A boolean value where true indicates custom filtering is active, and false indicates default filtering. The default value is false.

    Remarks

    This property determines whether the dropdown uses custom filtering logic, typically set during specific filtering operations.

    IsEntireDataUpdated

    Gets or sets a value indicating whether the entire data set has been updated.

    Declaration
    protected bool IsEntireDataUpdated { get; set; }
    Property Value
    Type Description
    System.Boolean

    A boolean value where true indicates the entire data set has been updated, and false indicates partial or no update. The default value is false.

    Remarks

    This property is used to manage updates to the entire data set, especially during virtualization or data refresh.

    IsExecuteQueryCalled

    Gets or sets a value indicating whether the query execution has been called.

    Declaration
    protected bool IsExecuteQueryCalled { get; set; }
    Property Value
    Type Description
    System.Boolean

    A boolean value where true indicates the query has been executed, and false indicates it has not. The default value is false.

    Remarks

    This property tracks whether a query execution has occurred, used to manage data processing states.

    IsMultiSelect

    Gets or sets a value indicating whether the dropdown supports multiple selections.

    Declaration
    protected bool IsMultiSelect { get; set; }
    Property Value
    Type Description
    System.Boolean

    A boolean value where true enables multi-selection, and false enables single selection. The default value is false.

    Remarks

    This property determines whether the dropdown allows selecting multiple items, typically used in components like SfMultiSelect<TValue, TItem>.

    IsReOrderData

    Gets or sets a value indicating whether the data source is reordered.

    Declaration
    protected bool IsReOrderData { get; set; }
    Property Value
    Type Description
    System.Boolean

    A boolean value where true indicates the data source is reordered, and false indicates no reordering. The default value is false.

    Remarks

    This property tracks whether the data source has been reordered, typically during virtualization or sorting operations.

    IsVirtualizationEnabled

    Gets or sets a value indicating whether virtualization is enabled.

    Declaration
    protected bool IsVirtualizationEnabled { get; set; }
    Property Value
    Type Description
    System.Boolean

    A boolean value where true enables virtualization, and false disables it. The default value is false.

    Remarks

    This property enables or disables virtualization, which optimizes rendering for large data sets by loading only visible items.

    IsVirtualSelectAll

    Gets or sets a value indicating whether all items are selected in virtualization mode.

    Declaration
    protected bool IsVirtualSelectAll { get; set; }
    Property Value
    Type Description
    System.Boolean

    A boolean value where true indicates all items are selected, and false indicates partial or no selection. The default value is false.

    Remarks

    This property is used in virtualization mode to manage the select-all state for multi-selection dropdowns.

    ItemTemplate

    Gets or sets the template for rendering each list item in the dropdown's popup.

    Declaration
    public RenderFragment<T> ItemTemplate { get; set; }
    Property Value
    Type Description
    Microsoft.AspNetCore.Components.RenderFragment<T>

    A Microsoft.AspNetCore.Components.RenderFragment<> representing the template for list items. The default value is null.

    Remarks

    This property allows customization of individual list items in the dropdown's popup. The template receives the current item context (of type T) for rendering, enabling dynamic rendering based on the data source.

    Examples

    Example of a custom item template:

    <SfDropDownList TValue="string" TItem="MyData">
        <DropDownsTemplates>
            <ItemTemplate>
                <span>@context.Name</span>
            </ItemTemplate>
        </DropDownsTemplates>
    </SfDropDownList>
    @code {
        public class MyData { public string Name { get; set; } }
    }

    JsRuntime

    Declaration
    protected IJSRuntime JsRuntime { get; set; }
    Property Value
    Type Description
    Microsoft.JSInterop.IJSRuntime

    An Microsoft.JSInterop.IJSRuntime instance for JavaScript interop. The default value is injected by the framework.

    Remarks

    This property provides access to the JavaScript runtime, used for client-side operations like updating list height or DOM manipulation.

    ListHeight

    Gets or sets the height of the dropdown's list element in pixels.

    Declaration
    protected int ListHeight { get; set; }
    Property Value
    Type Description
    System.Int32

    An integer representing the height of the list element. The default value is 0.

    Remarks

    This property is updated by client-side JavaScript to reflect the actual height of the rendered list element.

    ListItemsCount

    Gets or sets the number of items to render in the dropdown's list.

    Declaration
    protected int ListItemsCount { get; set; }
    Property Value
    Type Description
    System.Int32

    An integer representing the number of items to render. The default value is 30.

    Remarks

    This property controls the number of items displayed in the dropdown's popup, balancing performance and usability.

    ListVirtualData

    Gets or sets the virtual list data configuration.

    Declaration
    protected VirtualListData ListVirtualData { get; set; }
    Property Value
    Type Description
    VirtualListData

    A VirtualListData instance containing virtualization data settings. The default value is a new instance of VirtualListData.

    Remarks

    This property holds configuration data for virtualized list rendering, such as item sizes and indices.

    NoRecordsTemplate

    Gets or sets the template displayed when no data is available in the dropdown.

    Declaration
    public RenderFragment NoRecordsTemplate { get; set; }
    Property Value
    Type Description
    Microsoft.AspNetCore.Components.RenderFragment

    A Microsoft.AspNetCore.Components.RenderFragment representing the no-records template. The default value is null.

    Remarks

    This property defines the content shown in the dropdown's popup when the DataSource is empty. If not set, a default message is displayed.

    Examples

    Example of a no-records template:

    <SfDropDownList TValue="string" TItem="string">
        <DropDownsTemplates>
            <NoRecordsTemplate>
                <div>No items available</div>
            </NoRecordsTemplate>
        </DropDownsTemplates>
    </SfDropDownList>

    PreviousFocusData

    Gets or sets the previously focused data item.

    Declaration
    protected T PreviousFocusData { get; set; }
    Property Value
    Type Description
    T

    A T representing the previously focused item. The default value is the default value of T.

    Remarks

    This property tracks the last focused item during user interactions, such as keyboard navigation.

    Query

    Gets or sets the query for data processing.

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

    A Query object used for data fetching and filtering. The default value is null.

    Remarks

    This property allows specifying a query to filter, sort, or paginate the data source, especially when using a DataManager for remote data fetching.

    Examples

    Example of using a query:

    <SfDropDownList TValue="string" TItem="string" Query="@query" DataSource="@data">
    </SfDropDownList>
    @code {
        private List<string> data = new List<string> { "Item1", "Item2", "Item3" };
        private Query query = new Query().Take(2);
    }

    reflectionHelper

    Gets or sets the reflection helper for accessing object properties.

    Declaration
    protected ReflectionHelper reflectionHelper { get; set; }
    Property Value
    Type Description
    Syncfusion.Blazor.ReflectionHelper

    A ReflectionHelper instance used for property access. The default value is a new instance of ReflectionHelper.

    Remarks

    This property is used internally to handle reflection-based property access for complex data types in the dropdown component.

    ReOrderData

    Gets or sets the reordered data source for virtualization.

    Declaration
    protected IEnumerable<ListOptions<T>> ReOrderData { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.IEnumerable<ListOptions<T>>

    An IEnumerable<ListOptions<T>> containing the reordered data source. The default value is an empty enumerable.

    Remarks

    This property holds the reordered data source used when virtualization is enabled, ensuring efficient rendering of sorted data.

    ScrollActions

    Gets or sets the virtual action for scrolling.

    Declaration
    protected VirtualAction ScrollActions { get; set; }
    Property Value
    Type Description
    Syncfusion.Blazor.DropDowns.VirtualAction

    A Syncfusion.Blazor.DropDowns.SfDropDownBase<T>.VirtualAction instance for handling scroll actions in virtualization. The default value is null.

    Remarks

    This property manages scroll-related actions when virtualization is enabled, optimizing data loading during scrolling.

    SelectedValueAction

    Gets or sets the virtual action for selected values.

    Declaration
    protected VirtualAction SelectedValueAction { get; set; }
    Property Value
    Type Description
    Syncfusion.Blazor.DropDowns.VirtualAction

    A Syncfusion.Blazor.DropDowns.SfDropDownBase<T>.VirtualAction instance for handling selected value actions in virtualization. The default value is null.

    Remarks

    This property is used to manage actions related to selected values when virtualization is enabled.

    SortOrder

    Gets or sets the sort order for the dropdown's data source.

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

    A SortOrder value specifying the sorting mode. The default value is None.

    Remarks

    This property controls how the data source is sorted. Available options are:

    • None: No sorting applied.
    • Ascending: Sorts in ascending order.
    • Descending: Sorts in descending order.
    Examples

    Example of sorting the dropdown data:

    <SfDropDownList TValue="string" TItem="string" SortOrder="SortOrder.Ascending" DataSource="@data">
    </SfDropDownList>
    @code {
        private List<string> data = new List<string> { "Banana", "Apple", "Cherry" };
    }

    VirtualCustomData

    Gets or sets the custom data for virtualization scenarios.

    Declaration
    protected T VirtualCustomData { get; set; }
    Property Value
    Type Description
    T

    A T representing custom data for virtualization. The default value is the default value of T.

    Remarks

    This property holds custom data used in virtualization scenarios, such as pre-selected items.

    VirtualGroupDataSource

    Gets or sets the virtual group data source for virtualization.

    Declaration
    protected IEnumerable<T> VirtualGroupDataSource { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.IEnumerable<T>

    An IEnumerable<T> containing the group data for virtualized rendering. The default value is null.

    Remarks

    This property is used when virtualization is enabled to manage grouped data for efficient rendering.

    VirtualItemEndIndex

    Gets or sets the end index for virtualized items.

    Declaration
    protected int VirtualItemEndIndex { get; set; }
    Property Value
    Type Description
    System.Int32

    An integer representing the end index of virtualized items. The default value is 0.

    Remarks

    This property defines the range of items rendered in the virtualized dropdown list.

    VirtualItemStartIndex

    Gets or sets the start index for virtualized items.

    Declaration
    protected int VirtualItemStartIndex { get; set; }
    Property Value
    Type Description
    System.Int32

    An integer representing the start index of virtualized items. The default value is 0.

    Remarks

    This property defines the starting point for rendering virtualized items in the dropdown list.

    VirtualListHeight

    Gets or sets the height of the virtual list in pixels.

    Declaration
    protected int VirtualListHeight { get; set; }
    Property Value
    Type Description
    System.Int32

    An integer representing the height of the virtual list. The default value is 0.

    Remarks

    This property defines the height of the virtualized list container, used for calculating visible items.

    VirtualSelectAllDataSource

    Gets or sets the data source for select-all in virtualization mode.

    Declaration
    protected IEnumerable<ListOptions<T>> VirtualSelectAllDataSource { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.IEnumerable<ListOptions<T>>

    An IEnumerable<ListOptions<T>> containing the data source for select-all. The default value is null.

    Remarks

    This property holds the data source used when selecting all items in virtualization mode.

    ZIndex

    Gets or sets the z-index of the dropdown's popup element.

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

    A double value representing the z-index of the popup. The default value is 1000.

    Remarks

    This property controls the stacking order of the dropdown's popup relative to other elements on the page. Higher values place the popup above other elements.

    Examples

    Example of setting the z-index:

    <SfDropDownList TValue="string" TItem="string" ZIndex="2000" DataSource="@data">
    </SfDropDownList>
    @code {
        private List<string> data = new List<string> { "Item1", "Item2" };
    }

    Methods

    ActionCompleteAsync(IEnumerable<T>, Query)

    Asynchronously triggers the action complete event after data processing.

    Declaration
    protected virtual Task ActionCompleteAsync(IEnumerable<T> dataSource, Query query = null)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<T> dataSource

    The processed data source.

    Query query

    The query applied to the data source.

    Returns
    Type Description
    System.Threading.Tasks.Task

    A System.Threading.Tasks.Task representing the asynchronous operation.

    Remarks

    This method is called after successful data processing to notify that the data fetch is complete.

    ActionFailureAsync(Object)

    Asynchronously triggers the action failure event when data processing fails.

    Declaration
    protected virtual Task ActionFailureAsync(object arguments)
    Parameters
    Type Name Description
    System.Object arguments

    The exception or error details.

    Returns
    Type Description
    System.Threading.Tasks.Task

    A System.Threading.Tasks.Task representing the asynchronous operation.

    Remarks

    This method is called when an error occurs during data processing, typically setting Syncfusion.Blazor.DropDowns.SfDropDownBase<T>.IsActionFailed to true.

    AddItemsAsync(IEnumerable<T>, Nullable<Int32>)

    Asynchronously adds new items to the dropdown's popup list.

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

    The items to append to the list.

    System.Nullable<System.Int32> itemIndex

    The index at which to insert the items. If null, items are appended to the end.

    Returns
    Type Description
    System.Threading.Tasks.Task

    A System.Threading.Tasks.Task representing the asynchronous operation.

    Remarks

    This method adds new items to the dropdown's Syncfusion.Blazor.DropDowns.SfDropDownBase`1.ListData and updates the UI. If itemIndex is specified, items are inserted at that position; otherwise, they are appended.

    Examples

    Example of adding items to the dropdown:

    <SfDropDownList @ref="dropdown" TValue="string" TItem="string" DataSource="@data">
    </SfDropDownList>
    @code {
        private SfDropDownList<string, string> dropdown;
        private List<string> data = new List<string> { "Item1", "Item2" };
        private async Task AddNewItems()
        {
            await dropdown.AddItemsAsync(new List<string> { "Item3" }, 1);
        }
    }

    CheckSanitizer(String)

    Checks if the provided HTML content contains special characters that require sanitization.

    Declaration
    protected static bool CheckSanitizer(string htmlContent)
    Parameters
    Type Name Description
    System.String htmlContent

    The HTML content to check.

    Returns
    Type Description
    System.Boolean

    A boolean indicating whether the content contains special characters.

    Remarks

    This method uses a regular expression to detect HTML special characters (such as <, >, &, ", ', (, )) in the htmlContent. It returns true if sanitization is needed, otherwise false.

    CloneQuery(Query)

    Clones a query to ensure immutability.

    Declaration
    protected Query CloneQuery(Query query)
    Parameters
    Type Name Description
    Query query

    The query to clone.

    Returns
    Type Description
    Query

    A cloned Query object.

    Remarks

    This method creates a deep copy of the provided query to prevent unintended modifications to the original query.

    DataProcessAsync(VirtualAction, Boolean)

    Asynchronously processes data for virtualization based on the provided action and popup state.

    Declaration
    protected Task DataProcessAsync(VirtualAction action = null, bool isOpenPopup = false)
    Parameters
    Type Name Description
    Syncfusion.Blazor.DropDowns.VirtualAction action

    The Syncfusion.Blazor.DropDowns.SfDropDownBase<T>.VirtualAction containing virtualization settings, or null to use existing settings.

    System.Boolean isOpenPopup

    Indicates whether the popup is being opened.

    Returns
    Type Description
    System.Threading.Tasks.Task

    A System.Threading.Tasks.Task representing the asynchronous operation.

    Remarks

    This method updates virtualization indices and processes the data source using the specified or default query. It sets properties like VirtualItemStartIndex, VirtualItemEndIndex, and ListHeight based on the provided action. It also triggers Syncfusion.Blazor.DropDowns.SfDropDownBase`1.GenerateQueryAndSetQueryIndexAsync(Syncfusion.Blazor.Data.Query,System.Int32,System.Int32,System.Boolean) to generate and execute the query.

    DisableListItem(ListOptions<T>)

    Disables a list item by updating its CSS class and attributes.

    Declaration
    protected void DisableListItem(ListOptions<T> disableItem)
    Parameters
    Type Name Description
    ListOptions<T> disableItem

    The ListOptions<T> representing the list item to disable.

    Remarks

    This method adds the Syncfusion.Blazor.DropDowns.SfDropDownBase`1.DISABLED_ITEM CSS class to the disableItem's Syncfusion.Blazor.DropDowns.ListOptions`1.ListClass and sets the aria-selected and aria-disabled attributes in Syncfusion.Blazor.DropDowns.ListOptions`1.ListAttribute to disable the item.

    Dispose(Boolean)

    Disposes of the component and its resources.

    Declaration
    protected override void Dispose(bool disposing)
    Parameters
    Type Name Description
    System.Boolean disposing

    Indicates whether to dispose managed resources.

    Overrides
    SfBaseComponent.Dispose(Boolean)
    Remarks

    This method overrides the base class's dispose method to clean up resources, including calling ReflectionHelper.Dispose for the ReflectionHelper.

    ExecuteSimpleQuery(IEnumerable<T>, Query, Boolean)

    Executes a simple query on the data source.

    Declaration
    protected IEnumerable<T> ExecuteSimpleQuery(IEnumerable<T> data, Query query, bool isUpdateCount = false)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<T> data

    The data source to query.

    Query query

    The query to apply.

    System.Boolean isUpdateCount

    Indicates whether to update the data count.

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<T>

    An System.Collections.Generic.IEnumerable<> containing the query results.

    Remarks

    This method applies filtering, sorting, and pagination to the data based on the query. If isUpdateCount is true, it updates Syncfusion.Blazor.DropDowns.SfDropDownBase`1.DataCount and Syncfusion.Blazor.DropDowns.SfDropDownBase<T>.TotalCount.

    GenerateAndExecuteQueryAsync(Query, Int32, Int32)

    Asynchronously generates and executes a query to fetch virtualized data.

    Declaration
    protected Task GenerateAndExecuteQueryAsync(Query query, int virtualItemStartIndex = 0, int virtualItemEndIndex = 0)
    Parameters
    Type Name Description
    Query query

    The Query to execute.

    System.Int32 virtualItemStartIndex

    The starting index for the query.

    System.Int32 virtualItemEndIndex

    The ending index for the query.

    Returns
    Type Description
    System.Threading.Tasks.Task

    A System.Threading.Tasks.Task representing the asynchronous operation.

    Remarks

    This method prepares the query by applying pagination using Syncfusion.Blazor.DropDowns.SfDropDownBase<T>.GetPageQuery(Syncfusion.Blazor.Data.Query, System.Int32, System.Int32) and sets the take value with Syncfusion.Blazor.DropDowns.SfDropDownBase<T>.GetTakeValue(). It updates the data source and calls Syncfusion.Blazor.DropDowns.SfDropDownBase<T>.SetListDataAsync(System.Collections.Generic.IEnumerable<T>, Syncfusion.Blazor.DropDowns.FieldSettingsModel, Syncfusion.Blazor.Data.Query) to process the data.

    GetDataSourceAsync(IEnumerable<T>, Query)

    Retrieves the data source for rendering list items.

    Declaration
    protected Task<IEnumerable<ListOptions<T>>> GetDataSourceAsync(IEnumerable<T> dataSource, Query query)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<T> dataSource

    The data source to process.

    Query query

    The query to apply to the data source.

    Returns
    Type Description
    System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<ListOptions<T>>>

    A System.Threading.Tasks.Task containing an IEnumerable<ListOptions<T>> of processed list items.

    Remarks

    This method processes the dataSource with the specified query to generate a list of ListOptions<T> items, including metadata like text, value, and CSS classes.

    GetGroupedDataSourceAsync(IEnumerable<T>, SortOrder)

    Retrieves the grouped data source for rendering.

    Declaration
    protected Task<IEnumerable<ListOptions<T>>> GetGroupedDataSourceAsync(IEnumerable<T> dataSource, SortOrder sortOrder)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<T> dataSource

    The data source to group.

    SortOrder sortOrder

    The sort order to apply.

    Returns
    Type Description
    System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<ListOptions<T>>>

    A System.Threading.Tasks.Task containing an IEnumerable<ListOptions<T>> of grouped list items.

    Remarks

    This method processes the dataSource to create grouped list items based on the GroupBy property, applying the specified sortOrder.

    GetSkeletonCount(Boolean)

    Calculates the number of skeleton elements for virtualization.

    Declaration
    protected void GetSkeletonCount(bool RetainSkeleton = false)
    Parameters
    Type Name Description
    System.Boolean RetainSkeleton

    Indicates whether to retain the existing skeleton count.

    Remarks

    This method computes the number of skeleton elements based on the virtual list height and item count. It updates Syncfusion.Blazor.DropDowns.SfDropDownBase`1.SkeletonCount and ListItemsCount based on the query's take value or the default item count.

    InsertItemAsync(IEnumerable<T>, Nullable<Int32>, Boolean)

    Asynchronously inserts items into the dropdown's popup list.

    Declaration
    protected Task InsertItemAsync(IEnumerable<T> items, Nullable<int> itemIndex = null, bool preventInit = false)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<T> items

    The items to insert.

    System.Nullable<System.Int32> itemIndex

    The index at which to insert the items. If null, items are appended.

    System.Boolean preventInit

    Indicates whether to prevent initialization of the list data.

    Returns
    Type Description
    System.Threading.Tasks.Task

    A System.Threading.Tasks.Task representing the asynchronous operation.

    Remarks

    This method inserts items into Syncfusion.Blazor.DropDowns.SfDropDownBase`1.ListData and, if in filter mode for a SfComboBox<TValue, TItem>, updates Syncfusion.Blazor.DropDowns.SfDropDownBase<T>.MainData. It calls Syncfusion.Blazor.DropDowns.SfDropDownBase<T>.RenderItemsAsync(System.Collections.Generic.IEnumerable<T>) to refresh the UI.

    IsCustomValue()

    Declaration
    protected virtual bool IsCustomValue()
    Returns
    Type
    System.Boolean

    IsDisable(T)

    Determines whether a list item is disabled based on its data.

    Declaration
    protected bool IsDisable(T listItem)
    Parameters
    Type Name Description
    T listItem

    The data item to check for disabled status.

    Returns
    Type Description
    System.Boolean

    A boolean indicating whether the list item is disabled. Returns true if disabled, otherwise false.

    Remarks

    This method checks the Disabled property of the listItem to determine if it is disabled, handling boolean or string values.

    IsFilterMode()

    Determines whether the dropdown is in filter mode.

    Declaration
    protected virtual bool IsFilterMode()
    Returns
    Type Description
    System.Boolean

    A boolean indicating whether the dropdown is in filter mode.

    Remarks

    This method checks if the dropdown is configured to support filtering, used internally to adjust data processing behavior.

    IsPrimitiveDataType()

    Determines whether the data type is a primitive or simple type.

    Declaration
    protected bool IsPrimitiveDataType()
    Returns
    Type Description
    System.Boolean

    A boolean indicating whether the type parameter T is a primitive type.

    Remarks

    This method checks if T is a primitive type (e.g., string, int, double) or a nullable version of such types, used to optimize data processing.

    Examples

    Example of checking primitive data type:

    var isPrimitive = dropdown.IsPrimitiveDataType(); // Returns true for string, int, etc.

    IsVirtualization(Boolean, Boolean, Boolean, Boolean)

    Configures virtualization and related settings for the dropdown.

    Declaration
    protected virtual void IsVirtualization(bool isVirtualization, bool isAllowFiltering, bool isDropDown, bool deviceSpecific)
    Parameters
    Type Name Description
    System.Boolean isVirtualization

    Indicates whether virtualization is enabled.

    System.Boolean isAllowFiltering

    Indicates whether filtering is allowed.

    System.Boolean isDropDown

    Indicates whether the component is a dropdown.

    System.Boolean deviceSpecific

    Indicates whether device-specific behavior is applied.

    Remarks

    This method sets the IsVirtualizationEnabled, Syncfusion.Blazor.DropDowns.SfDropDownBase`1.IsFiltering, Syncfusion.Blazor.DropDowns.SfDropDownBase`1.IsDropDown, and Syncfusion.Blazor.DropDowns.SfDropDownBase`1.DeviceSpecific properties to configure the dropdown's behavior.

    ListItemCreated(ListOptions<T>)

    Customizes a list item when it is created.

    Declaration
    protected virtual ListOptions<T> ListItemCreated(ListOptions<T> listItem)
    Parameters
    Type Name Description
    ListOptions<T> listItem

    The ListOptions<T> representing the list item.

    Returns
    Type Description
    ListOptions<T>

    The modified or unmodified ListOptions<T> instance.

    Remarks

    This virtual method allows derived classes to customize the ListOptions<T> object after it is created, typically used for modifying properties like text or CSS classes.

    SetCurrentViewDataAsync(Int32, Int32)

    Asynchronously updates the current view data for virtualization.

    Declaration
    protected virtual Task SetCurrentViewDataAsync(int virtualItemStartIndex, int virtualItemEndIndex)
    Parameters
    Type Name Description
    System.Int32 virtualItemStartIndex

    The starting index of the visible items.

    System.Int32 virtualItemEndIndex

    The ending index of the visible items.

    Returns
    Type Description
    System.Threading.Tasks.Task

    A System.Threading.Tasks.Task representing the asynchronous operation.

    Remarks

    This virtual method is a placeholder for derived classes to implement custom logic for updating the visible data in the dropdown when virtualization is enabled.

    SetFields()

    Sets the field mappings for the dropdown's data source.

    Declaration
    protected void SetFields()
    Remarks

    This method configures the Syncfusion.Blazor.DropDowns.SfDropDownBase`1.Fields property, ensuring that Value and Text are set appropriately. If both are unset, it defaults to using "text" for both.

    SetItemValue(String, Type)

    Sets the value of an item based on the specified value and type.

    Declaration
    protected T SetItemValue(string itemValue, Type valueType = null)
    Parameters
    Type Name Description
    System.String itemValue

    The value to set for the item.

    System.Type valueType

    The type of the value, or null to use the default type.

    Returns
    Type Description
    T

    A T representing the created or updated item.

    Remarks

    This method creates or updates an item of type T with the specified itemValue, handling primitive types, tuples, dynamic objects, and complex types with reflection.

    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved