Seems pretty simple, but I can't find anything in the documentation or in these forums. Can someone please help?
We do this a lot in our apps. Basically add something like this to your window constructor:
DataGrid.MouseDoubleClick += new MouseButtonEventHandler(DataGridOnMouseDoubleClick);
Replace "DataGrid" with the name of your XamDataGrid.
Then, you just need to write the event handler with something like this:
private void DataGridOnMouseDoubleClick(Object sender, RoutedEventArgs e)
{
DataRecord activeRecord = (DataGrid.ActiveRecord as DataRecord);
if ((activeRecord != null) && (!activeRecord.IsAddRecord))
....some stuff here with activeRecord
}
I am not quite sure whether this would throw exceptions, depending on where you click.
EventManager.RegisterClassHandler(typeof(DataRecordPresenter), DataRecordPresenter.MouseDoubleClickEvent, new MouseButtonEventHandler(dr_MouseDoubleClick));
void dr_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e){MessageBox.Show(sender.ToString() + "was doubleclicked");}