简体   繁体   English

确定DevExpress GridControl中单击的行

[英]Determine clicked row in DevExpress GridControl

I have a DevExpress GridControl: 我有一个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() . 在事件处理程序中,我可以通过调用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. 谢谢。

This is all you need: 这就是你所需要的:

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

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

在这里 - > Wpf datagrid行双击你可以找到一个很好的文章为该主题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM