vain0x / DotNetKit.Wpf.AutoCompleteComboBox

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

dynamically load items #16

Closed aldrin-ronco closed 4 years ago

aldrin-ronco commented 4 years ago

Hello friends

First of all I apologize for asking this question here, since I do not think it is the appropriate channel, but it is the place that I see closest to a solution to my problem.

I want to use this control, but in my case I do not have a pre-loaded collection of elements, the data source has more than 30,000 records, therefore my intention is to load the data as the user enters the text.

For this reason I need to obtain the content that the user has typed, for that I create a property in my viewmodel which I link to the Text property of the ComboBox, when the property has content, I execute the query against the database.

Everything seems to work as expected, until I choose an item from the suggestion list and this causes the content of the Text property to disappear, destroying all my hopes.

Is it possible to obtain the desired behavior by establishing the correct properties or following a specific pattern?

I would appreciate any help, a link or any idea that puts me in the right direction, I have been watching content on the web for more than a week without finding a satisfactory solution to a problem that, in my opinion, does not have the greatest complexity

Thank you very much for taking the time to read this.

vain0x commented 4 years ago

Everything seems to work as expected, until I choose an item from the suggestion list and this causes the content of the Text property to disappear, destroying all my hopes.

I watched the combobox's Text property by running the Demo project, where items aren't dynamically loaded. When an item is selected, Text is set to the item's text, based on TextSearch.TextPath. I'm wondering what causes the Text property to disappear.

Could you give me an example code? Thanks.

Diff of experiment ```diff diff --git a/DotNetKit.Wpf.AutoCompleteComboBox.Demo/MainWindow.xaml b/DotNetKit.Wpf.AutoCompleteComboBox.Demo/MainWindow.xaml index 68dbd45..80f9eda 100644 --- a/DotNetKit.Wpf.AutoCompleteComboBox.Demo/MainWindow.xaml +++ b/DotNetKit.Wpf.AutoCompleteComboBox.Demo/MainWindow.xaml @@ -37,6 +37,7 @@ + @@ -44,10 +45,13 @@ + +
aldrin-ronco commented 4 years ago

In the end I gave up and decided to solve it through a change in design.

Thanks for the help