Won't Fix
Last Updated: 20 Dec 2021 15:51 by Stenly
Stenly
Created on: 20 Dec 2021 11:11
Category: AutoCompleteBox
Type: Bug Report
1
AutoCompleteBox: Wrong item is removed when having duplicate selected items
When clicking the remove button on an item, which is present more than once in the selection textbox, the first occurrence will be removed, rather than the corresponding item.
1 comment
Stenly
Posted on: 20 Dec 2021 15:51

The behavior could be achieved by extending the RadAutoCompleteBox control and by defining OnExecuted and Executed methods for the RadAutoCompleteBoxCommands.RemoveItem command.

In the OnExecuted method, the current AutoCompleteBoxItem can be obtained using the ParentOfType extension method, called on the e.OriginalSource property. Then, on the returned value, call the same ParentOfType method and get the AutoCompleteBoxesWrapPanel class. After that, call the IndexOf method, with the returned autocomplete box item as parameter, on the Children property of the wrap panel. Finally, cast the SelectedItems collection to IList and call the RemoveAt method with the returned value from the IndexOf method.