combobox - Can I navigate into and out of a wpf combo box using arrow keys instead of tab? -


i have wpf usercontrol containing combobox , textbox in row. way move between components tab between them, able switch combobox textbox using left , right arrow keys.

it not easy slapping eventhandler on keyup event.

void combokeyup( object sender, keyeventargs e ) {     if( e.key == key.right)     {         e.handled = true;         textbox.focus();     } } 

...because combo change value despite event being reported handled.

is there way doesn't simultaneously break up/down selection of items in combo box?

i have created combobox textboxes:

<combobox width="100" height="25"  previewkeydown="comboboxpreviewkeydown">   <combobox.items>      <textbox text="item 1"/>     <textbox text="item 2"/>     <textbox text="item 3"/>   </combobox.items> </combobox> 

then added handler:

    private void comboboxpreviewkeydown(object sender, keyeventargs e)     {         action<focusnavigationdirection> movefocus = focusdirection => {             e.handled = true;             var request = new traversalrequest(focusdirection);                     var focusedelement = keyboard.focusedelement uielement;             if (focusedelement != null)                 focusedelement.movefocus(request);         };          if (e.key == key.down)             movefocus(focusnavigationdirection.next);         else if (e.key == key.up)             movefocus(focusnavigationdirection.previous);      } 

now "up" , "down" buttons behavior same "tab" , "shift+tab"


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -