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)//点击在行中 { //事件处理 } }