The grid's mousedoubleclick fires no matter where the user double clicks including headers and the scroll bar.
How can I properly detect that they've only double clicked on a row?
Thanks!! That worked!
You could check if the DataRecordPresenter is representing a HeaderRecord with the IsHeaderRecord property :
DataRecordPresenter drp = sender as DataRecordPresenter;
if (!drp.IsHeaderRecord)
{
MessageBox.Show(drp.ToString());
}
Thank You!!
Unfortunately, your example is still trapping double clicks on the column headers.
Option 1 : EventManager.RegisterClassHandler(typeof(DataRecordPresenter), DataRecordPresenter.PreviewMouseDoubleClickEvent, new MouseButtonEventHandler(OnPreviewMouseDoubleClick));
private void OnPreviewMouseDoubleClick(object sender, MouseButtonEventArgs e)
MessageBox.Show((sender as DataRecordPresenter).ToString());
How about posting some sample code? I have a this.DataGrid available to me. How do I register an event on the DataRecordPresenter?