Class RadzenDropDown<TValue>
RadzenDropDown component.
Inherited Members
Namespace: Radzen.Blazor
Assembly: Radzen.Blazor.dll
Syntax
public class RadzenDropDown<TValue> : DropDownBase<TValue>, IComponent, IHandleEvent, IHandleAfterRender, IDisposable, IRadzenFormComponent
Type Parameters
Name | Description |
---|---|
TValue | The type of the value. |
Examples
<RadzenDropDown @bind-Value=@customerID TValue="string" Data=@customers TextProperty="CompanyName" ValueProperty="CustomerID" Change=@(args => Console.WriteLine($"Selected CustomerID: {args}")) />
Constructors
RadzenDropDown()
RadzenDropDown component.
Declaration
public RadzenDropDown()
Examples
<RadzenDropDown @bind-Value=@customerID TValue="string" Data=@customers TextProperty="CompanyName" ValueProperty="CustomerID" Change=@(args => Console.WriteLine($"Selected CustomerID: {args}")) />
Properties
Chips
Gets or sets a value indicating whether the selected items will be displayed as chips. Set to false
by default.
Requires Multiple to be set to true
.
Declaration
[Parameter]
public bool Chips { get; set; }
Property Value
Type | Description |
---|---|
bool |
|
ClearSearchAfterSelection
Gets or sets a value indicating whether search field need to be cleared after selection. Set to false
by default.
Declaration
[Parameter]
public bool ClearSearchAfterSelection { get; set; }
Property Value
Type | Description |
---|---|
bool |
|
Close
Callback for when a dropdown is closed.
Declaration
[Parameter]
public EventCallback Close { get; set; }
Property Value
Type | Description |
---|---|
EventCallback |
EmptyTemplate
Gets or sets the empty template.
Declaration
[Parameter]
public RenderFragment EmptyTemplate { get; set; }
Property Value
Type | Description |
---|---|
RenderFragment | The empty template. |
FilterAutoCompleteType
Gets or Sets the filter autocomplete type.
Declaration
[Parameter]
public AutoCompleteType FilterAutoCompleteType { get; set; }
Property Value
Type | Description |
---|---|
AutoCompleteType | The filter autocomplete type. Default: Off |
FilterPlaceholder
Gets or sets the filter placeholder.
Declaration
[Parameter]
public string FilterPlaceholder { get; set; }
Property Value
Type | Description |
---|---|
string | The filter placeholder. |
InputAttributes
Specifies additional custom attributes that will be rendered by the input.
Declaration
[Parameter]
public IReadOnlyDictionary<string, object> InputAttributes { get; set; }
Property Value
Type | Description |
---|---|
IReadOnlyDictionary<string, object> | The attributes. |
ItemRender
Gets or sets the row render callback. Use it to set row attributes.
Declaration
[Parameter]
public Action<DropDownItemRenderEventArgs<TValue>> ItemRender { get; set; }
Property Value
Type | Description |
---|---|
Action<DropDownItemRenderEventArgs<TValue>> | The row render callback. |
MaxSelectedLabels
Gets or sets the number of maximum selected labels.
Declaration
[Parameter]
public int MaxSelectedLabels { get; set; }
Property Value
Type | Description |
---|---|
int | The number of maximum selected labels. |
Open
Callback for when a dropdown is opened.
Declaration
[Parameter]
public EventCallback Open { get; set; }
Property Value
Type | Description |
---|---|
EventCallback |
OpenOnFocus
Gets or sets a value indicating whether popup should open on focus. Set to false
by default.
Declaration
[Parameter]
public bool OpenOnFocus { get; set; }
Property Value
Type | Description |
---|---|
bool |
|
PopupStyle
Gets or sets the Popup height.
Declaration
[Parameter]
public string PopupStyle { get; set; }
Property Value
Type | Description |
---|---|
string | The number Popup height. |
ReadOnly
Gets or sets a value indicating whether is read only.
Declaration
[Parameter]
public bool ReadOnly { get; set; }
Property Value
Type | Description |
---|---|
bool |
|
SelectAllText
Gets or sets the select all text.
Declaration
[Parameter]
public string SelectAllText { get; set; }
Property Value
Type | Description |
---|---|
string | The select all text. |
SelectedItemsText
Gets or sets the selected items text.
Declaration
[Parameter]
public string SelectedItemsText { get; set; }
Property Value
Type | Description |
---|---|
string | The selected items text. |
ValueTemplate
Gets or sets the value template.
Declaration
[Parameter]
public RenderFragment<dynamic> ValueTemplate { get; set; }
Property Value
Type | Description |
---|---|
RenderFragment<dynamic> | The value template. |
Methods
BuildRenderTree(RenderTreeBuilder)
RadzenDropDown component.
Declaration
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
Type | Name | Description |
---|---|---|
RenderTreeBuilder | __builder |
Overrides
Dispose()
Disposes this instance.
Declaration
public override void Dispose()
Overrides
GetComponentCssClass()
Gets the component CSS class.
Declaration
protected override string GetComponentCssClass()
Returns
Type | Description |
---|---|
string |
Overrides
HandleKeyPress(KeyboardEventArgs, bool, bool?)
Handles the key press.
Declaration
protected override Task HandleKeyPress(KeyboardEventArgs args, bool isFilter, bool? shouldSelectOnChange = null)
Parameters
Type | Name | Description |
---|---|---|
KeyboardEventArgs | args | The KeyboardEventArgs instance containing the event data. |
bool | isFilter | if set to |
bool? | shouldSelectOnChange | Should select item on item change with keyboard. |
Returns
Type | Description |
---|---|
Task |
Overrides
OnAfterRenderAsync(bool)
Called when [after render asynchronous].
Declaration
protected override Task OnAfterRenderAsync(bool firstRender)
Parameters
Type | Name | Description |
---|---|---|
bool | firstRender | if set to |
Returns
Type | Description |
---|---|
Task | Task. |
Overrides
OnClose()
Called when popup is closed.
Declaration
[JSInvokable]
public Task OnClose()
Returns
Type | Description |
---|---|
Task |
OnSelectItem(object, bool)
Called when item is selected.
Declaration
protected override Task OnSelectItem(object item, bool isFromKey = false)
Parameters
Type | Name | Description |
---|---|---|
object | item | The item. |
bool | isFromKey | if set to |
Returns
Type | Description |
---|---|
Task |
Overrides
OpenPopup(string, bool, bool)
Opens the popup.
Declaration
protected override Task OpenPopup(string key = "ArrowDown", bool isFilter = false, bool isFromClick = false)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key. |
bool | isFilter | if set to |
bool | isFromClick | if set to |
Returns
Type | Description |
---|---|
Task |
Overrides
SelectAll()
Selects all.
Declaration
protected override Task SelectAll()
Returns
Type | Description |
---|---|
Task |
Overrides
SetParametersAsync(ParameterView)
Set parameters as an asynchronous operation.
Declaration
public override Task SetParametersAsync(ParameterView parameters)
Parameters
Type | Name | Description |
---|---|---|
ParameterView | parameters | The parameters. |
Returns
Type | Description |
---|---|
Task | A Task representing the asynchronous operation. |