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