Welcome to the Blazor feedback portal. We’re happy you’re here! If you have feedback on how to improve the Blazor, we’d love to hear it!

  • Check out the features or bugs others have reported and vote on your favorites. Feedback will be prioritized based on popularity.
  • If you have feedback that’s not listed yet, submit your own.

Thanks for joining our community and helping improve Syncfusion products!

1
Vote

I'm unable to add items programmatically.  I've tried various attempts and none seem to work.  The RemoveItem method works, but can't get the AddItem method to work.  Not sure if this is a bug or if I am doing something wrong.  I've noticed the "AddItems" method in your documentation, which is not available now - only "AddItem".


Here are some of my attempts:


<SfListBox @ref="vendorList" TValue=int[]" DataSource="@vendors" TItem="VendorModel">

   <ListBoxFieldSettings Text="VendorName" Value="Id" />

</SfListBox>


private SfListBox<int[], VendorModel> vendorList;

(have also tried with SfListBox<string[], VendorModel> vendorList;


Attempt #1:

private async Task AddNewVendor(VendorModel vendor)

{

   List<VendorModel> newVendor = new List<VendorModel> {vendor};

   await vendorList.AddItem(newVendor);


  StateHasChanged();

}


Attempt #2:

private void AddNewVendor(VendorModel vendor)

{

   List<VendorModel> newVendor = new List<VendorModel> {vendor};

   vendorList.AddItem(newVendor);


  StateHasChanged();

}


I've also tried adding to data source - both as a list and as observable collection.