1
我有以下情況。如何在更新後直接從未綁定的列中獲取單元值?
我從一組對象構建一個網格。我比添加兩個未綁定的列。 第一個未綁定列具有RepositoryItemSpinEdit編輯器幷包含整數。第二個未綁定列只包含整數。
我想更改第一個立即更新第二列。但第二列只有在第一列失去焦點後纔會更新。它顯示位置中的更新值,而利用位置中的前值計算利潤。 任何想法如何欺騙系統做我想做的事?
var spinEditor = new RepositoryItemSpinEdit
{
MaxValue = 999999,
MinValue = -999999,
IsFloatValue = false,
};
spinEditor.EditValueChanged += this.CalculateProfit;
this.gridView.GridControl.RepositoryItems.Add(spinEditor);
this.gridView.Columns.AddField("Position");
this.gridView.Columns["Position"].Caption = "Position";
this.gridView.Columns["Position"].VisibleIndex = this.grid.VisibleColumns.Count;
this.gridView.Columns["Position"].ColumnEdit = spinEditor;
this.gridView.Columns["Position"].UnboundType = UnboundColumnType.Integer;
this.gridView.Columns["Position"].DisplayFormat.FormatType = FormatType.Numeric;
this.gridView.Columns.AddField("Profit");
this.gridView.Columns["Profit"].Caption = "PnL";
this.gridView.Columns["Profit"].VisibleIndex = this.gridView.VisibleColumns.Count;
this.gridView.Columns["Profit"].UnboundType = UnboundColumnType.Decimal;
this.gridView.Columns["Profit"].DisplayFormat.FormatType = FormatType.Numeric;
private void CalculateProfit(object sender, EventArgs eventArgs)
{
int rowIndex = this.gridView.FocusedRowHandle;
var curve = this.gridView.GetRow(rowIndex) as Curve;
this.gridControl.SetGridViewCurve(curve.ID, "Profit", curve.Price * curve.Position);
}