Пример #1
0
 private void WardBox_OnPreviewKeyUp(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Back || e.Key == Key.Space)
     {
         WardBox.IsDropDownOpen = true;
         var be = WardBox.GetBindingExpression(ComboBox.TextProperty);
         be.UpdateSource();
     }
     if (e.Key == Key.Up && WardBox.IsDropDownOpen)
     {
         if (WardBox.SelectedIndex != -1)
         {
             WardBox.SelectedIndex = WardBox.SelectedIndex - 1;
             if (WardBox.SelectedIndex == -1)
             {
                 var be = WardBox.GetBindingExpression(ComboBox.TextProperty);
                 be.UpdateSource();
             }
         }
     }
     if (e.Key == Key.Down && WardBox.IsDropDownOpen)
     {
         if (WardBox.SelectedIndex < WardBox.Items.Count)
         {
             WardBox.SelectedIndex = WardBox.SelectedIndex + 1;
         }
     }
 }
Пример #2
0
        private void WardBox_OnTextInput(object sender, TextCompositionEventArgs e)
        {
            WardBox.IsDropDownOpen = true;
            var be = WardBox.GetBindingExpression(ComboBox.TextProperty);

            be.UpdateSource();
        }