I have used a Datagrid
and a button(btnAdd
) in WPF
.The button is default.I need to call btnAdd_Click
(which uses the selected row of the Datagrid
) when Enter
key is pressed.
In other words i need to select a row & press Enter
& do the work done by btnAdd_Click
.
<Button Name="btnAdd" Click="btnAdd_Click" IsDefault="True" TabIndex="4" >Add to List</Button>
you can get the PreviewKeyDown and mark e.Handeled = true
dg = DataGrid