private void NurseComboBox_OnPreviewKeyUp(object sender, KeyEventArgs e) { if (e.Key == Key.Back || e.Key == Key.Space) { NurseComboBox.IsDropDownOpen = true; var be = NurseComboBox.GetBindingExpression(ComboBox.TextProperty); be.UpdateSource(); } if (e.Key == Key.Up && NurseComboBox.IsDropDownOpen) { if (NurseComboBox.SelectedIndex != -1) { NurseComboBox.SelectedIndex = NurseComboBox.SelectedIndex - 1; if (NurseComboBox.SelectedIndex == -1) { var be = NurseComboBox.GetBindingExpression(ComboBox.TextProperty); be.UpdateSource(); } } } if (e.Key == Key.Down && NurseComboBox.IsDropDownOpen) { if (NurseComboBox.SelectedIndex < NurseComboBox.Items.Count) { NurseComboBox.SelectedIndex = NurseComboBox.SelectedIndex + 1; } } }
private void NurseComboBox_OnTextInput(object sender, TextCompositionEventArgs textCompositionEventArgs) { NurseComboBox.IsDropDownOpen = true; var be = NurseComboBox.GetBindingExpression(ComboBox.TextProperty); be.UpdateSource(); }