Zak
Zak

Reputation: 734

Determine clicked row in DevExpress GridControl

I have a DevExpress GridControl:

<dxg:GridControl ItemsSource="{Binding Path=MyData}" MouseDoubleClick="GridControl_MouseDoubleClick" />

In the event handler I can determine the focused row nicely by calling GetFocusedRow(). However, the handler gets also called when the scroll bar gets clicked twice in quick succession.

How can I determine if the user actually double-clicked a row? Or can I easily attach an event handler to the rows without much restyling?

Thanks.

Upvotes: 1

Views: 3768

Answers (2)

Willem
Willem

Reputation: 9496

This is all you need:

TableViewHitInfo hi = ((TableView)gridControl.View).CalcHitInfo(e.OriginalSource as DependencyObject);

if (hi.InRow)
{
    //Do work...
}

Upvotes: 3

Andre
Andre

Reputation: 1044

Here -> Wpf datagrid row double click you can find a nice article for that topic.

Upvotes: 1

Related Questions