Class DropDownBase<T>
- Namespace
- Radzen
- Assembly
- Radzen.Blazor.dll
Base class of components that display a list of items.
public class DropDownBase<T> : DataBoundFormComponent<T>, IComponent, IHandleEvent, IHandleAfterRender, IDisposable, IRadzenFormComponent
Type Parameters
T
- Inheritance
-
DropDownBase<T>
- Implements
- Derived
- Inherited Members
Constructors
DropDownBase()
public DropDownBase()
Fields
list
The list
protected ElementReference? list
Field Value
search
The search
protected ElementReference search
Field Value
selectedIndex
The selected index
protected int selectedIndex
Field Value
selectedItem
The selected item
protected object selectedItem
Field Value
selectedItems
The selected items
protected IList<object> selectedItems
Field Value
Properties
AllowClear
Gets or sets a value indicating whether the user can clear the value. Set to false
by default.
[Parameter]
public bool AllowClear { get; set; }
Property Value
- bool
true
if clearing is allowed; otherwise,false
.
AllowFiltering
Gets or sets a value indicating whether filtering is allowed. Set to false
by default.
[Parameter]
public virtual bool AllowFiltering { get; set; }
Property Value
- bool
true
if filtering is allowed; otherwise,false
.
AllowSelectAll
Gets or sets a value indicating whether the user can select all values in multiple selection. Set to true
by default.
[Parameter]
public bool AllowSelectAll { get; set; }
Property Value
- bool
true
if select all values is allowed; otherwise,false
.
AllowVirtualization
Specifies wether virtualization is enabled. Set to false
by default.
[Parameter]
public bool AllowVirtualization { get; set; }
Property Value
Count
Specifies the total number of items in the data source.
[Parameter]
public int Count { get; set; }
Property Value
Data
Gets or sets the data.
[Parameter]
public override IEnumerable Data { get; set; }
Property Value
- IEnumerable
The data.
DisabledProperty
Gets or sets the disabled property.
[Parameter]
public string DisabledProperty { get; set; }
Property Value
- string
The disabled property.
EmptyAriaLabel
Gets or sets the empty value aria label text.
[Parameter]
public string EmptyAriaLabel { get; set; }
Property Value
- string
The empty value aria label text.
FilterAsYouType
Gets or sets a value indicating whether filtering is allowed as you type. Set to true
by default.
[Parameter]
public virtual bool FilterAsYouType { get; set; }
Property Value
- bool
true
if filtering is allowed; otherwise,false
.
FilterDelay
Gets or sets the filter delay.
[Parameter]
public int FilterDelay { get; set; }
Property Value
- int
The filter delay.
HasValue
public override bool HasValue { get; }
Property Value
HeaderTemplate
Gets or sets the header template.
[Parameter]
public RenderFragment HeaderTemplate { get; set; }
Property Value
- RenderFragment
The header template.
Items
Gets the items.
protected virtual IEnumerable<object> Items { get; }
Property Value
- IEnumerable<object>
The items.
Multiple
Gets or sets a value indicating whether this DropDownBase<T> is multiple.
[Parameter]
public bool Multiple { get; set; }
Property Value
- bool
true
if multiple; otherwise,false
.
PageSize
Specifies the default page size. Set to 5
by default.
[Parameter]
public int PageSize { get; set; }
Property Value
PopupID
Gets the popup identifier.
protected string PopupID { get; }
Property Value
- string
The popup identifier.
RemoveChipTitle
Gets or sets the remove chip button title.
[Parameter]
public string RemoveChipTitle { get; set; }
Property Value
- string
The remove chip button title.
SearchAriaLabel
Gets or sets the search aria label text.
[Parameter]
public string SearchAriaLabel { get; set; }
Property Value
- string
The search aria label text.
SearchID
Gets the search identifier.
public string SearchID { get; }
Property Value
- string
The search identifier.
SelectedItem
Gets or sets the selected item.
[Parameter]
public object SelectedItem { get; set; }
Property Value
- object
The selected item.
SelectedItemChanged
Gets or sets the selected item changed.
[Parameter]
public EventCallback<object> SelectedItemChanged { get; set; }
Property Value
- EventCallback<object>
The selected item changed.
Separator
Gets or sets the item separator for Multiple dropdown.
[Parameter]
public string Separator { get; set; }
Property Value
- string
Item separator
Template
Gets or sets the template.
[Parameter]
public RenderFragment<dynamic> Template { get; set; }
Property Value
- RenderFragment<dynamic>
The template.
ValueProperty
Gets or sets the value property.
[Parameter]
public string ValueProperty { get; set; }
Property Value
- string
The value property.
View
Gets the view.
protected override IEnumerable View { get; }
Property Value
- IEnumerable
The view.
VirtualizationOverscanCount
Gets or sets a value that determines how many additional items will be rendered before and after the visible region. This help to reduce the frequency of rendering during scrolling. However, higher values mean that more elements will be present in the page.
[Parameter]
public int VirtualizationOverscanCount { get; set; }
Property Value
Virtualize
The Virtualize instance.
public Virtualize<object> Virtualize { get; }
Property Value
Methods
ClearAll()
Clears all.
protected Task ClearAll()
Returns
Dispose()
public override void Dispose()
GetItemOrValueFromProperty(object, string)
Gets the item or value from property.
public object GetItemOrValueFromProperty(object item, string property)
Parameters
Returns
- object
System.Object.
GetValue()
public override object GetValue()
Returns
HandleKeyPress(KeyboardEventArgs, bool, bool?)
Handles the key press.
protected virtual Task HandleKeyPress(KeyboardEventArgs args, bool isFilter = false, bool? shouldSelectOnChange = null)
Parameters
args
KeyboardEventArgsThe KeyboardEventArgs instance containing the event data.
isFilter
boolif set to
true
[is filter].shouldSelectOnChange
bool?Should select item on item change with keyboard.
Returns
OnAfterRenderAsync(bool)
Called when [after render asynchronous].
protected override Task OnAfterRenderAsync(bool firstRender)
Parameters
firstRender
boolif set to
true
[first render].
Returns
- Task
Task.
OnChange(ChangeEventArgs)
Handles the Change event.
protected void OnChange(ChangeEventArgs args)
Parameters
args
ChangeEventArgsThe ChangeEventArgs instance containing the event data.
OnDataChanged()
protected override Task OnDataChanged()
Returns
OnFilter(ChangeEventArgs)
Handles the Filter event.
protected virtual Task OnFilter(ChangeEventArgs args)
Parameters
args
ChangeEventArgsThe ChangeEventArgs instance containing the event data.
Returns
OnFilterKeyPress(KeyboardEventArgs)
Handles the FilterKeyPress event.
protected virtual Task OnFilterKeyPress(KeyboardEventArgs args)
Parameters
args
KeyboardEventArgsThe KeyboardEventArgs instance containing the event data.
Returns
OnInitialized()
protected override void OnInitialized()
OnKeyPress(KeyboardEventArgs, bool?)
Handles the KeyPress event.
protected virtual Task OnKeyPress(KeyboardEventArgs args, bool? shouldSelectOnChange = null)
Parameters
args
KeyboardEventArgsThe KeyboardEventArgs instance containing the event data.
shouldSelectOnChange
bool?Should select item on item change with keyboard.
Returns
OnParametersSet()
protected override void OnParametersSet()
OnParametersSetAsync()
Called when [parameters set asynchronous].
protected override Task OnParametersSetAsync()
Returns
- Task
Task.
OnSelectItem(object, bool)
Called when [select item].
protected virtual Task OnSelectItem(object item, bool isFromKey = false)
Parameters
Returns
OpenPopup(string, bool, bool)
Opens the popup.
protected virtual Task OpenPopup(string key = "ArrowDown", bool isFilter = false, bool isFromClick = false)
Parameters
key
stringThe key.
isFilter
boolif set to
true
[is filter].isFromClick
boolif set to
true
[is from click].
Returns
OpenPopupScript()
Opens the popup script.
protected string OpenPopupScript()
Returns
- string
System.String.
OpenPopupScriptFromParent()
Opens the popup script from parent.
protected string OpenPopupScriptFromParent()
Returns
- string
System.String.
Reset()
Resets this instance.
public void Reset()
SelectAll()
Selects all.
protected virtual Task SelectAll()
Returns
SelectItem(object, bool)
Selects the item.
public Task SelectItem(object item, bool raiseChange = true)
Parameters
Returns
SelectItemFromValue(object)
Selects the item from value.
protected virtual void SelectItemFromValue(object value)
Parameters
value
objectThe value.
SetParametersAsync(ParameterView)
Set parameters as an asynchronous operation.
public override Task SetParametersAsync(ParameterView parameters)
Parameters
parameters
ParameterViewThe parameters.
Returns
- Task
A Task representing the asynchronous operation.