Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2325
XAM Data grid :: Set Edit Mode on Clicking F2
posted

Hi Team,

When the User clicks on a cell in the Xam data grid, the cell  should be selected but not go into edit mode,  Only if the user clicks (F2) then the cell should

be editable,  after editing when user clicks on Enter, cell should no more be editable.  

I used below events but are not working as expected.

private void dgDeviceList_CellActivated(object sender, Infragistics.Windows.DataPresenter.Events.CellActivatedEventArgs e)
{
Dispatcher.BeginInvoke(new Action(() =>
{
    CellValuePresenter.FromCell(e.Cell).Editor.EndEditMode(True,True);
}
), System.Windows.Threading.DispatcherPriority.Background, null);

}

private void xamDataGrid1_PreviewKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter || e.Key == Key.Left || e.Key == Key.Up || e.Key == Key.Down)
dgDeviceList.ExecuteCommand(DataPresenterCommands.EndEditModeAndAcceptChanges);

if (e.Key == Key.F2)
{
dgDeviceList.ExecuteCommand(DataPresenterCommands.StartEditMode);

}


}

How could i achieve this.