[Irving] Wpf DevexPress GridControl 获取选中行

时间:2021-11-24 07:14:55

WPF前台绑定事件代码:

<RelayAction TargetControl="{Binding ElementName=GCInstoragePart}" MethodName="GridClick"   MethodParameter="{XParamBinding me}"  TriggerEvent="Click" />

  

后台事件代码:

 public void GridClick(RelayAction r, ExecuteEventArgs e)
{
var mouse = e.TriggerParameter as MouseButtonEventArgs;
var viewCon = e.MethodParameter as InstorageCount;
var hitInfo = ((DevExpress.Xpf.Grid.TableView)viewCon.GVInstoragePartInf).CalcHitInfo((DependencyObject)mouse.OriginalSource); if (hitInfo.InRow)//点击在行中
{
//事件处理
}
}