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,
What you can do is to use the EventManager.RegisterClassHandler and register this event only for the DataRecordPresenter or create a style for the DataRecordPresenter/ DataRecordCellArea element and use an EventSetter to hook up this event.
Thanks but without sample code to get to the "DataRecordPresenter" this wasn't helpful at all. I finally got a working solution using some techniques from this post:
http://community.infragistics.com/forums/p/7652/96199.aspx#96199
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?
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.
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?
Any solution for this with all the changes in XAML itself? I am using MVVM.
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.