Exemple #1
0
 private void BedBox_OnPreviewKeyUp(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Back || e.Key == Key.Space)
     {
         BedBox.IsDropDownOpen = true;
         var be = BedBox.GetBindingExpression(ComboBox.TextProperty);
         be.UpdateSource();
     }
     if (e.Key == Key.Up && BedBox.IsDropDownOpen)
     {
         if (BedBox.SelectedIndex != -1)
         {
             BedBox.SelectedIndex = BedBox.SelectedIndex - 1;
             if (BedBox.SelectedIndex == -1)
             {
                 var be = BedBox.GetBindingExpression(ComboBox.TextProperty);
                 be.UpdateSource();
             }
         }
     }
     if (e.Key == Key.Down && BedBox.IsDropDownOpen)
     {
         if (BedBox.SelectedIndex < BedBox.Items.Count)
         {
             BedBox.SelectedIndex = BedBox.SelectedIndex + 1;
         }
     }
 }
Exemple #2
0
        private void BedBox_OnTextInput(object sender, TextCompositionEventArgs e)
        {
            BedBox.IsDropDownOpen = true;
            var be = BedBox.GetBindingExpression(ComboBox.TextProperty);

            be.UpdateSource();
        }