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 SelectingItemsControl (or specifically ListBox) is set to SelectionMode = Single, with an ObserivableCollection bound to the SelectedItems property. When selection changes, the action type for the event on the ObservableCollection is Remove instead of Reset. This is an issue if items that are not in the ItemsSource can be selected. (Like sharing selection between multiple ListBoxes)
As a note, the TreeView will raise the event with the Reset action instead, under the same conditions.
To Reproduce
Create a default MVVM application.
Replace the body of the MainView.axaml with the following
Replace the body of MainViewModel.cs with the following
publicObservableCollection<object>SelectedItems{get;set;}publicMainViewModel(){SelectedItems=newObservableCollection<object>();SelectedItems.CollectionChanged+=(sender,args)=>{// Set break point here ^^^^^};}
Set a break point where specified.
Run in debug mode, change selection.
Change selection a second time.
Expected behavior
When selection changes from an existing selection, args.Action should be NotifyCollectionChangedAction.Reset.
Avalonia version
11.2.2
OS
Windows
Additional context
No response
The text was updated successfully, but these errors were encountered:
Describe the bug
When a
SelectingItemsControl
(or specificallyListBox
) is set toSelectionMode = Single
, with anObserivableCollection
bound to theSelectedItems
property. When selection changes, the action type for the event on theObservableCollection
isRemove
instead ofReset
. This is an issue if items that are not in the ItemsSource can be selected. (Like sharing selection between multiple ListBoxes)As a note, the
TreeView
will raise the event with theReset
action instead, under the same conditions.To Reproduce
MainView.axaml
with the followingMainViewModel.cs
with the followingExpected behavior
When selection changes from an existing selection,
args.Action
should beNotifyCollectionChangedAction.Reset
.Avalonia version
11.2.2
OS
Windows
Additional context
No response
The text was updated successfully, but these errors were encountered: