Dear All,
How To Shift Focus from One Control To another control when Enter key is pressed in silverlight application?
Thanks in advance.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Priya LingePosted Aug 17, 2011, 8:01 AM
I have two controls in my silverlight application, textbox1 and textbox2.
On KeyDown event of textbox1 by pressing enter key focus will shift to textbox2 as below,
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key.Equals(Key.Enter))
{
textBox2.Focus();
}
}
Hope this will help you.
Thanks.
maheshPosted Aug 17, 2011, 10:25 AM
maheshPosted Aug 17, 2011, 9:17 AM
Priya LingePosted Aug 17, 2011, 9:09 AM
Please try this
I take ComboBox and datapicker controls in silverlight.
private void comboBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key.Equals(Key.Enter))
{
datePicker1.Focus();
}
}
private void datePicker1_KeyUp(object sender, KeyEventArgs e)
{
if (e.Key.Equals(Key.Enter))
{
comboBox1.Focus();
}
}
private void datePicker1_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key.Equals(Key.Enter))
{
comboBox1.Focus();
}
}
Thanks.
maheshPosted Aug 17, 2011, 8:22 AM
maheshPosted Aug 17, 2011, 8:10 AM