خرید بک لینک

Vote count: 0

Is there a way to navigate through a ComboBox elements when dropped down using arrow keys ? I am searching through items from an SQL server and they are displayed but I want to traverse through them using the keyboard instead of the mouse. I tried something like that but it didn't work :

private void StackPanel_PreviewKeyDown(object sender, KeyEventArgs e)
{
    if (e.Key == Key.Down)
    {
        ComboBox = e.Source as ComboBox;
        if (s != null)
        {
            s.MoveFocus(new TraversalRequest( FocusNavigationDirection.Next));
        }

        e.Handled = true;
    }
}

Xaml : <ComboBox1 PreviewKeyDown="StackPanel_PreviewKeyDown" />

Code source from : Moving to next control on Enter keypress in WPF

Here is the combobox : enter image description here

A minor detail, also is there away to remove the highlight from the typed letter ? In this case the letter "e" as displayed in the screen shot. Thank you so much in advanced I would really appreciate it if you could help me.

asked 15 secs ago

برچسب: نویسنده: استخدام کار تاريخ: دوشنبه 28 تير 1395 ساعت: 14:43

صفحه بندی