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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Priya LingeRank #785 · 2.9K reputationPosted Aug 17, 2011, 4:01 AM EDT
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.
mahesh112 reputationPosted Aug 17, 2011, 4:10 AM EDT
mahesh112 reputationPosted Aug 17, 2011, 4:22 AM EDT
Priya LingeRank #785 · 2.9K reputationPosted Aug 17, 2011, 5:09 AM EDT
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.
mahesh112 reputationPosted Aug 17, 2011, 5:17 AM EDT
mahesh112 reputationPosted Aug 17, 2011, 6:25 AM EDT