/// <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); } }
/// <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 dimensional arrays", "array"); } this.data = array; if (array.Rank == 2) { rowCount = array.GetLength(0); colCount = array.GetLength(1); type = ArrayDataType.Multidimensional; } else { if (array.GetValue(0) is Array) { Array row = array.GetValue(0) as Array; rowCount = array.GetLength(0); colCount = row.GetLength(0); type = ArrayDataType.Jagged; } else { rowCount = 1; colCount = array.GetLength(0); type = ArrayDataType.Simple; } } rows = new ArrayRowView[rowCount]; for (int i = 0; i < rows.Length; i++) { rows[i] = new ArrayRowView(this, i); } }