WPF ComboBox for slow machines

In my WPF application, I use combobox. When the user wants to select an item, he can enter letters, and combobox proceeds to the next record starting with these letters. If the user stops typing and starts again after some delay, combobox assumes that the user has started a new word. It’s good that the usual behavior of ComboBox is nothing special ... The problem is that some of our users are slow. Is there a way to increase the time allowed between entering two letters without combobox, assuming the user is looking for a new word? I hope you know what I mean ...

+6
source share
1 answer

You can go through the full passage and flip your own filtered combo box. Check out this code and see if it helps.

XAML:

<ComboBox x:Name="myComboBox" TextBoxBase.TextChanged="myComboBox_TextChanged" DisplayMemberPath="myDisplay" IsEditable="True" StaysOpenOnEdit="True" SelectionChanged="myComboBox_SelectionChanged" /> 

Then under the hood:

 ObservableCollection<myType> myCollection; public ICollectionView cvs { get; set; } public MyWindow() { InitializeComponent(); myCollection = new ObservableCollection<myType>(); cvs = CollectionViewSource.GetDefaultView(myCollection); myComboBox.ItemsSource = cvs; cvs.Filter = FilterOut; } private void myComboBox_TextChanged(object sender, TextChangedEventArgs e) { cvs.Refresh(); } private bool FilterOut(object input) { myType item = (myType)input; return ( string.IsNullOrEmpty(myComboBox.Text) || item.myDisplay.Contains(myComboBox.Text)); } 
0
source

All Articles