wpf - Set focus to another element with default button event? -
i have tried following:
<button isdefault="true" content="process test file" focusmanager.focusedelement="{binding elementname=txtclientid}" command="{binding processfilecommand, updatesourcetrigger=propertychanged}"> </button>
i have button set default. so, when user hits enter key processes command, doesn't set focus asked. however, when clicked mouse set focus. i'm sure there's got easy way setting focus work default action too.
do focusing in button's click
event. it'll called when press enter, too.
<button isdefault="true" content="process test file" command="{binding processfilecommand, updatesourcetrigger=propertychanged}" click="button_click"> </button>
then, in code-behind:
private void button_click(object sender, routedeventargs e) { keyboard.focus(txtclientid); }
Comments
Post a Comment