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?
Hello,
As Alex explianed It seems like that the best option is to check in the handler of the event whether the sender is header record, by using the IsHeaderRecord Property, and if it is not execute your code.
Hope this helps you.
Any solution for this with all the changes in XAML itself? I am using MVVM.
Is there anyway to do this all in XAML? I am attempting to avoid any code-behind as I am using MVVM. I have it working with the Style option you posted, but it is still calling the event when you double-click the header. Any suggestions for a XAML-only solution?
The EventManager will register this event for all instances of that class. You could check which XamDataGrid is currently invoking this event through the DataRecordPresenter.DataPresenter property and not handle or handle it appropriately.
If that is not an option, then you should use Option 2, which uses a style. The style will register this event only for the instances that it applies to. Therefore, you could put this style in a particular XamDataGrid's Resources and it will apply only for its DataRecordPresenters.
One more problem. The way you are registering the event, it's getting registered statically. I had placed this in my constructor. But then when I have multiple grids on the screen, it fires over and over again for each instance of a grid. So I can't register it in the constructor. How do I register that event but only for the grids I want to?