how can i change enter key in silverlight forms to tab key.i use the following code in winforms but i don’t know how can i implement this in silverlight!
/// <summary>
/// Change Enter key To Tab Key
/// </summary>
/// <param name="msg"></param>
/// <param name="keyData"></param>
/// <returns></returns>
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (msg.Msg == 256 && keyData == Keys.Enter)
{
// Execute an alternative action: here we tabulate in order to focus on the next control in the formular
if (ActiveControl.ToString().Contains("System.Windows.Forms.Button") ||
ActiveControl.ToString().Contains("DevComponents.DotNetBar.ButtonX"))
return base.ProcessCmdKey(ref msg, keyData);
SendKeys.Send("{TAB}");
// return true to stop any further interpretation of this key action
return true;
}
return base.ProcessCmdKey(ref msg, keyData);
}
In Silverlight we have KeyDown Event on that we can check that which key have been pressed. You can write a function in KeyDown event and in that check if e.key == Enter if The Enter key presses than made focus to the Desired TextBox to which you want.