private void positionWatchGrid_RecordFixedLocationChanged(object sender, Infragistics.Windows.DataPresenter.Events.RecordFixedLocationChangedEventArgs e) { StockPositionViewModel sd = (e.Record as Infragistics.Windows.DataPresenter.DataRecord).DataItem as StockPositionViewModel; if (e.Record.IsFixed) { _vm.AddStockCommand.Execute(sd.Symbol); } else { _vm.RemoveStockCommand.Execute(sd.Symbol); } }
private void positionWatchGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e) { DependencyObject source = e.OriginalSource as DependencyObject; if (source == null) { return; } if (source is FrameworkElement) { DataRecordPresenter drp = Infragistics.Windows.Utilities.GetAncestorFromType(source, typeof(DataRecordPresenter), true) as DataRecordPresenter; if (drp == null) { return; } if (drp.Record != null) { drp.Record.IsSelected = true; drp.IsActive = true; DataRecord r = drp.DataRecord; if (r != null) { StockPositionViewModel stockDetails = r.DataItem as StockPositionViewModel; if (stockDetails != null) { StockTransactionViewModel stockTransaction = new StockTransactionViewModel(); stockTransaction.Account = _vm.SelectedAccount; stockTransaction.StockTickerDetailsViewModel = stockDetails.StockTickerDetails; stockTransaction.StockPosition = stockDetails; stockTransaction.Quantity = stockDetails.Quantity; stockTransaction.TransactionType = TransactionType.Sell; if (this.BuySellCommand != null && this.BuySellCommand is RelayCommand <StockTransactionViewModel> ) { this.BuySellCommand.Execute(stockTransaction); } } } } } }