Unable to bind to SelectionModel.SelectedItems
or SelectedIndexes
#15497
Labels
SelectionModel.SelectedItems
or SelectedIndexes
#15497
Describe the bug
Reported by a customer:
Binding
ItemsControl.ItemsSource
toSelectionModel.SelectedItems
orSelectionModel.SelectedIndexes
does not work.SelectionModel
raises aPropertyChanged
event onSelectedItems
andSelectedIndexes
, but because the instance of the collection hasn't changed, property system doesn't consider the value to have changed, so consequently the boundItemsControl
doesn't register the change. This behaviour comes from WinUI which was the original source of ourSelectionModel
(though they have diverged significantly since the initial port):https://github.com/microsoft/microsoft-ui-xaml/blob/winui3/release/1.4-stable/controls/dev/Repeater/SelectionModel.cpp#L591-L592
I assume that the WinUI
SelectionModel
was written without the expectation that someone would bind to the selected collections on aSelectionModel
.To Reproduce
Expected behavior
SelectionModel.SelectedItems
orSelectionModel.SelectedIndexes
and should follow the usual semantics for property and collection changes, not the strange semantics we have inherited from WinUI.Avalonia version
all
OS
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: