Buttons acting as arrow keys in wpf
Im using a treeview, when i hit left arrow in keyboard the selected item in treeview expands and when i hit down arrow key the next item in the treeview is selected..So here I have two Buttons btnStepIn, btnStepOut which should exactly act like left and down arrow key..On btnStepIn button click right arrow key functionality should be performed and on btnStepOut button click down arrow key functionality should be performed..
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Milan Prajapati107 reputationPosted Oct 19, 2016, 10:00 PM EDT
$(document).keydown(function(e) { switch(e.which) { case 37: // left break; case 38: // up break; case 39: // right break; case 40: // down break; default: return; // exit this handler for other keys } e.preventDefault(); // prevent the default action (scroll / move caret) });