vain0x / DotNetKit.Wpf.AutoCompleteComboBox

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

Item selection in ComboBox breaks if DisplayMemberPath and TextSearch.TextPath point to different properties #19

Closed thatgim closed 1 year ago

thatgim commented 3 years ago

https://github.com/vain0x/DotNetKit.Wpf.AutoCompleteComboBox/blob/39e1f0e2bfbf1f5dbc1bac1e5cf87e2f4d8a728d/DotNetKit.Wpf.AutoCompleteComboBox/Windows/Controls/AutoCompleteComboBox.xaml.cs#L173 text gets filled by resolving DisplayMemberPath and TextFromItem(SelectedItem) gets filled by resolving TextSearch.TextPath. If these properties aren't set to the same/equivalent properties SelectedItem gets unset immediatly after selection.

I tried removing TextFromItem(SelectedItem) == text and it fixed this problem and didn't introduce any new problem as far as I can tell.

vain0x commented 3 years ago

Thanks for suggestion.

I tried to reproduce your situation (SelectedItem is unset) in the demo app but couldn't...: https://github.com/vain0x/DotNetKit.Wpf.AutoCompleteComboBox/commit/08c474560c42d562ce835354529e1aa8736b49bf It seems Text is filled by resolving TextPath rather than DisplayPath, as TextFromItem is.

I would be glad if a reproduction code is given.

vain0x commented 1 year ago

Closing since not reproduced. Feel free to reopen if someone want to discuss about this.