DotNetKit.Wpf.AutoCompleteComboBox
DotNetKit.Wpf.AutoCompleteComboBox copied to clipboard
Properly synchronize the current selected item - Improve and fix #28
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 :
- There is an existing CollectionView, in this case let's the CollectionView handle it like before.
- There is no CollectionView, so we create it, but after that, explicitly its position to -1, so no item is selected by default, this is for me the right approach to fix #27 with the benefit to not impact the existing CollectionView use case.
Thank you.
However this PR breaks in the situation of #28. It can reproduce with Test
project by the following steps:
- Input some text to filter (say,
aa
) and suggestion list is shown - Select one (
Aaron
) - Press the Reload button (i.e. assign new list to
ItemsSource
)
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.
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.
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.