WPF前臺綁定事件代碼:html
<RelayAction TargetControl="{Binding ElementName=GCInstoragePart}" MethodName="GridClick" MethodParameter="{XParamBinding me}" TriggerEvent="Click" />
後臺事件代碼:spa
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)//點擊在行中 { //事件處理 } }