Example #1
0
 private void cbx_PreviewKeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key != Key.Up && (e.Key == Key.Return || e.Key == Key.Return) && Cbx.LivePreviewItem != null)
     {
         Cbx.SelectedItem   = RuntimeHelpers.GetObjectValue(Cbx.LivePreviewItem);
         Tbx.SelectionStart = Tbx.Text.Length;
         Cbx.IsDropDownOpen = false;
         Tbx.Focus();
         e.Handled = true;
     }
 }
Example #2
0
 private void cbx_IsDropDownOpenChanged(object sender, EventArgs e)
 {
     if (Cbx.IsDropDownOpen)
     {
         return;
     }
     updating = true;
     try
     {
         Cbx.SelectedItem   = null;
         Tbx.SelectionStart = Tbx.Text.Length;
         Tbx.Focus();
     }
     finally
     {
         updating = false;
     }
 }
Example #3
0
        private void UpdateFilter()
        {
            if (Tbx.Text == string.Empty)
            {
                Cbx.IsDropDownOpen = false;
                Cbx.Items.Filter   = null;
            }
            else
            {
                updating = true;
                try
                {
                    Cbx.IsDropDownOpen = true;
                    if (Cbx.SelectedIndex != 0)
                    {
                        Cbx.Items.Filter = item =>
                        {
                            if (Tbx.Text.Length <= 0)
                            {
                                return(true);
                            }
                            var val = item as IComboBoxProperties;

                            if (val != null)
                            {
                                return(val.Name != null && val.Name.ToLower().Contains(Tbx.Text.ToLower()));
                            }
                            return(true);
                        };
                    }
                    Tbx.Focus();
                }
                finally
                {
                    updating = false;
                }
            }
        }