Hello,
I have this snippet in a new NET8 Blazor Project (Interactive Server)
@page "/test"
@rendermode @(new InteractiveServerRenderMode(prerender: false))
<h3>Testdropdown: </h3>
<RadzenDropDown @bind-Value=multipleValues Data=@customers Change="@OnChange"
AllowFiltering="true" FilterCaseSensitivity="Radzen.FilterCaseSensitivity.CaseInsensitive"
Name="DropDownMultipleChips"
Multiple=true AllowClear=true Placeholder="Placeholder" AllowSelectAll="true"
TextProperty="Text" ValueProperty="Value"
Chips=true />
@code {
IEnumerable<DropDownItem> customers;
IEnumerable<string> multipleValues;
protected override void OnInitialized()
{
customers = new List<DropDownItem>() { new DropDownItem("A", "1"), new DropDownItem("B", "2") };
}
void OnChange(object value)
{
var str = value is IEnumerable<object> ? string.Join(", ", (IEnumerable<object>)value) : value;
Console.WriteLine($"Value changed to {str}");
}
}
The search and selection works fine if I search with keyboard and click the option with a mouse. But when I filter and try to select an option with the arrow keys + enter, following exception is thrown:
warn: Microsoft.AspNetCore.Components.Server.Circuits.RemoteRenderer[100]
Unhandled exception rendering component: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
at System.Collections.Generic.List`1.get_Item(Int32 index)
at System.Linq.Enumerable.ElementAt[TSource](IEnumerable`1 source, Int32 index)
at Radzen.DropDownBase`1.HandleKeyPress(KeyboardEventArgs args, Boolean isFilter, Nullable`1 shouldSelectOnChange)
at Radzen.DropDownBase`1.OnFilterKeyPress(KeyboardEventArgs args)
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
fail: Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost[111]
Unhandled exception in circuit 'bmK_QszdTrY51bY_E17DwdRSE1NMcJ-ZPBm_RBkc2vw'.
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
at System.Collections.Generic.List`1.get_Item(Int32 index)
at System.Linq.Enumerable.ElementAt[TSource](IEnumerable`1 source, Int32 index)
at Radzen.DropDownBase`1.HandleKeyPress(KeyboardEventArgs args, Boolean isFilter, Nullable`1 shouldSelectOnChange)
at Radzen.DropDownBase`1.OnFilterKeyPress(KeyboardEventArgs args)
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
warn: Microsoft.AspNetCore.Components.Server.Circuits.RemoteRenderer[100]
Unhandled exception rendering component: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
at System.Collections.Generic.List`1.get_Item(Int32 index)
at System.Linq.Enumerable.ElementAt[TSource](IEnumerable`1 source, Int32 index)
at Radzen.DropDownBase`1.HandleKeyPress(KeyboardEventArgs args, Boolean isFilter, Nullable`1 shouldSelectOnChange)
at Radzen.DropDownBase`1.OnFilterKeyPress(KeyboardEventArgs args)
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
fail: Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost[111]
Unhandled exception in circuit '1jMcUgNazoxC2hhsAGoUqC9U-03S29dIqz0NstlP4Es'.
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
at System.Collections.Generic.List`1.get_Item(Int32 index)
at System.Linq.Enumerable.ElementAt[TSource](IEnumerable`1 source, Int32 index)
at Radzen.DropDownBase`1.HandleKeyPress(KeyboardEventArgs args, Boolean isFilter, Nullable`1 shouldSelectOnChange)
at Radzen.DropDownBase`1.OnFilterKeyPress(KeyboardEventArgs args)
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
Any idea how I can fix this or if I'm using something wrong?