Completed
Last Updated: 10 Aug 2016 10:50 by ADMIN
ADMIN
Dimitar
Created on: 05 Aug 2016 06:13
Category:
Type: Bug Report
2
FIX. RadListControl - when the selected items are changed in the SelectedItemsChanged event the selection is broken or exception is thrown
To reproduce:
- Add data items which have category, and set the SelectionMode to MultiExtended
- Then use the following code and select items from different category:
private void RadListControl1_SelectedItemsChanged(object sender, NotifyCollectionChangedEventArgs e)
{
    if (e.NewItems == null)
    {
        return;
    }

    var newCategory = (((RadListDataItem) e.NewItems[0]).DataBoundItem as MyData).Category;
    var prevCategory = (radListControl1.SelectedItem.DataBoundItem as MyData).Category;
    if (newCategory != prevCategory && radListControl1.SelectedItems.Count > 1)
    {
        radListControl1.SuspendSelectionEvents = true;
        //exception
        var items = radListControl1.SelectedItems.ToList();
        for (int i = 0; i < items.Count - 1; i++)
        {
            items[i].Selected = false;
        }
        //after this the selection is broken and the user cannot select an item
        //radListControl1.SelectedItem = null;

        radListControl1.SuspendSelectionEvents = false;
    }
}

0 comments