Beispiel #1
0
        /// <summary>
        ///   Sets a value to the array.
        /// </summary>
        public override void SetValue(object component, object value)
        {
            ArrayRowView rowView = component as ArrayRowView;

            if (rowView != null)
            {
                rowView.SetColumnValue(columnIndex, value);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Initializes a new ArrayDataView from array.
        /// </summary>
        /// <param name="array">array of data.</param>
        public ArrayDataView(Array array)
        {
            if (array.Rank > 2)
            {
                throw new ArgumentException("Supports only up to two dimentional arrays", "array");
            }

            this.data = array;

            if (array.Rank == 2)
            {
                rows = new ArrayRowView[array.GetLength(0)];

                for (int i = 0; i < rows.Length; i++)
                {
                    rows[i] = new ArrayRowView(this, i);
                }
            }
            else
            {
                rows = new ArrayRowView[] { new ArrayRowView(this, 0) };
            }
        }