You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a ListBox.ItemSource is bound to an ObservableCollection, and an item is selected, if Move() is called on the underlying item in the collection, then the ListBox selection is cleared. This does not happen if the selected item is not the one that Move() is called on, even though its position may change.
To Reproduce
The following example contains a ListBox bound to an ObservableCollection. The button calls Move() to move the first item to the end of the list. Note that when the first item is selected and subsequently moved, it is deselected. Selecting any other item and calling Move() causes the item's position to change, but it stays selected.
doobah
changed the title
ListBox deselects selected item when calling Move() on underlying ObservableCollection item
ListBox deselects selected item when calling Move() on bound ObservableCollection
Jul 12, 2024
Bug Description
When a ListBox.ItemSource is bound to an ObservableCollection, and an item is selected, if Move() is called on the underlying item in the collection, then the ListBox selection is cleared. This does not happen if the selected item is not the one that Move() is called on, even though its position may change.
To Reproduce
The following example contains a ListBox bound to an ObservableCollection. The button calls Move() to move the first item to the end of the list. Note that when the first item is selected and subsequently moved, it is deselected. Selecting any other item and calling Move() causes the item's position to change, but it stays selected.
XAML:
ViewModel:
Expected Behavior
The ListBox's selected item should remain selected after calling ObservableCollection.Move() on the underlying item.
Avalonia Version
11.1.0-rc2
OS
Windows
The text was updated successfully, but these errors were encountered: