How to prevent datagrid enter key goes to next row in silverlight
Thanks in advance.
Prevent DataGrid enter key goes to next row in silverlight
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
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
Shweta LodhaRank #31 · 39.8K reputationPosted Apr 3, 2014, 4:18 AM EDT
protected override void OnKeyDown(KeyEventArgs e)
{
DataGridCellInfo originalCell = CurrentCell;
base.OnKeyDown(e);
if (e.Key == Key.Enter)
{
// Select cell - don't want to select the next row with Summary Grid as it messes with updates. CurrentCell = originalCell;
SelectedCells.Clear();
SelectedCells.Add(CurrentCell);
} }
More at:
http://social.msdn.microsoft.com/Forums/vstudio/en-US/b7f36f96-e970-4c13-a333-35f20b659c59/datagrid-enterreturn-key-goes-to-next-row?forum=wpf
Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Apr 3, 2014, 4:34 AM EDT
You can handle the keydown event as repled, or use command provider like demonstrated here