c# - How to lose keyboard scope anywhere in the application? -


i have delegate command when invoked want lose focus on control has focus. using mvvm therefore code in delegate command's execute has no reference uielements. happy move focus or use kind of trick - needs agnostic control has focus.

don't mind if solution in xaml or c#.

perhaps should using traversalrequest class move focus next control? linked page, it:

represents request move focus control.

all need work focused element. again, linked page on msdn:

// creating focusnavigationdirection object , setting  // local field contains direction selected. focusnavigationdirection focusdirection = _focusmovevalue;  // movefocus takes traveralreqest argument. traversalrequest request = new traversalrequest(focusdirection);  // gets element keyboard focus. uielement elementwithfocus = keyboard.focusedelement uielement;  // change keyboard focus.  if (elementwithfocus != null) {     elementwithfocus.movefocus(request); } 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -