private void MaterialNameCb_TextChanged(object sender, TextChangedEventArgs e) { String text = this.MaterialNameCb.Text.Trim(); if (text.Length < 2) { isSelectMaterial = false; this.MaterialNameCb.IsDropDownOpen = false; } if (isSelectMaterial == true) { return; } if (text.Length >= 2) { List <Material> list = MaterialModel.IndistictSearchByNameORFirstCase(text); if (list.Count > 0) { isSelectMaterial = true; } this.tempMaterials.Clear(); foreach (var item in list) { this.tempMaterials.Add(item.id, item); } this.MaterialNameCb.ItemsSource = this.tempMaterials.Values.ToList(); if (this.MaterialNameCb.ItemsSource != null) { this.MaterialNameCb.IsDropDownOpen = true; } else { this.MaterialNameCb.IsDropDownOpen = false; } } else { this.MaterialNameCb.ItemsSource = App.tempMaterials.Values.ToList(); } }