Ejemplo n.º 1
0
        /// <summary>
        /// Commits the changes in the unbound cell where the renderer doesn't support value changed event.
        /// </summary>
        /// <param name="record">
        /// Specifies the corresponding record to commit the cell value.
        /// </param>
        /// <param name="column">
        /// Specifies the corresponding column to commit the cell value.
        /// </param>
        /// <param name="value">
        /// Specifies the cell value to commit it.
        /// </param>
        public void CommitUnBoundCellValue(object record, GridColumn column, object value)
        {
            var args = new GridUnboundColumnEventsArgs(UnBoundActions.CommitData, value, column, record, this.DataGrid);

            DataGrid.RaiseQueryUnboundValue(args);
        }
Ejemplo n.º 2
0
        } // end method DataGridStrikePriceVolumeTable_FilterItemsPopulating

        // Populate data of each day's volume for unbound columns.
        private void DataGridStrikePriceVolumeTable_QueryUnboundColumnValue(object sender, GridUnboundColumnEventsArgs e)
        {
            if (e.UnBoundAction != UnBoundActions.QueryData)
                return;
            
            var strikePrice = Convert.ToDecimal(e.Record.GetType().GetProperty("StrikePrice")?.GetValue(e.Record));
            
            // Round each volume value which is not null.
            for (var nodeCount = 0; nodeCount < _nodeTotalCount; nodeCount++)
                if (_strikePriceVolumeRowCollection[nodeCount][0] == strikePrice)
                {
                    var dayVolume = _strikePriceVolumeRowCollection[nodeCount][2 + Convert.ToInt32(e.Column.MappingName)];

                    /*
                     * 每日成交量(1手 = 100股)。
                     * First, round the day volume. Second, convert it to a string representation in a specified format. Then, convert it back to a decimal value. These steps are necessary to keep the specified number of decimal digits without dropping 0.
                     */
                    e.Value = dayVolume == null
                        ? null
                        : (decimal?) Convert.ToDecimal(decimal.Round((decimal) dayVolume / (Properties.Settings.Default.DayVolumeUnit * 100m), Properties.Settings.Default.DayVolumeDecimalDigits).ToString("N" + Properties.Settings.Default.DayVolumeDecimalDigits));

                    break;
                } // end if
        } // end method DataGridStrikePriceVolumeTable_QueryUnboundColumnValue