private void TradesGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e) { //the stuff here is to make sure the click is in a row and not elsewher on the grid if (e.LeftButton != MouseButtonState.Pressed) { return; } var result = VisualTreeHelper.HitTest(TradesGrid, e.GetPosition(TradesGrid)); var cell = Utils.FindVisualParent <DataGridCell>(result.VisualHit); if (cell == null) { return; } if (TradesGrid.SelectedItems == null || TradesGrid.SelectedItems.Count != 1) { return; } var tradeWindow = new TradeWindow((Trade)TradesGrid.SelectedItem, Context, Datasourcer); tradeWindow.Show(); }
private void TradesGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e) { //the stuff here is to make sure the click is in a row and not elsewher on the grid if (e.LeftButton != MouseButtonState.Pressed) return; var result = VisualTreeHelper.HitTest(TradesGrid, e.GetPosition(TradesGrid)); var cell = Utils.FindVisualParent<DataGridCell>(result.VisualHit); if (cell == null) return; if (TradesGrid.SelectedItems == null || TradesGrid.SelectedItems.Count != 1) return; var tradeWindow = new TradeWindow((Trade)TradesGrid.SelectedItem, Context, Datasourcer); tradeWindow.Show(); }