vain0x / DotNetKit.Wpf.AutoCompleteComboBox

ComboBox with filtering (auto-complete) for WPF
MIT License
71 stars 26 forks source link

Properly synchronize the current selected item - Improve and fix #28 #29

Open kvpt opened 1 year ago

kvpt commented 1 year ago

The PR #28 caused a regression when using a CollectionView, when the CollectionView is bound the SelectionItem is reset.

There is two cases to consider :

vain0x commented 1 year ago

Thank you.

However this PR breaks in the situation of #28. It can reproduce with Test project by the following steps:

At this time, on main (v1.6.0) the SelectedItem is intact, on item-reset-fix it's cleared.


The PR #28 caused a regression when using a CollectionView, when the CollectionView is bound the SelectionItem is reset.

Could you tell me how do you use CollectionView to reproduce this? I'm trying to reproduce as in a commit 0c9fbcf (in vnext branch) but not reproduced.


Recently I feel that providing CollectionViewSource (#26) isn't right way perhaps. Instead, ask users to wrap ItemsSource with CollectionViewSource for each combobox instance. I would like to hear users thoughts.

kvpt commented 1 year ago

Could you tell me how do you use CollectionView to reproduce this? I'm trying to reproduce as in a commit https://github.com/vain0x/DotNetKit.Wpf.AutoCompleteComboBox/commit/0c9fbcfaa9e7f320e77a2b482d78d159f462b3fb (in vnext branch) but not reproduced.

Sure, in my app I do two things, I use a CollectionView (a ListCollectionView to be precise) directly and I set the Selected Value in the code after the creating of the collection view.

Here the two changes in the test project that reproduce my issue. image

image

I can perhaps modify my app to use a CollectionViewSource instead of a CollectionView but I don't need this new level of indirection and this was working fine previously so I'm a bit reluctant to do it.

Recently I feel that providing CollectionViewSource (https://github.com/vain0x/DotNetKit.Wpf.AutoCompleteComboBox/pull/26) isn't right way perhaps. Instead, ask users to wrap ItemsSource with CollectionViewSource for each combobox instance. I would like to hear users thoughts.

I don't really have an opinion if it need to be supported or not directly by the component, but it certainly will be difficult to handle all the combinations and possible use cases.