XPTable.Models.Table.GetRowFromDataSource C# (CSharp) Method

GetRowFromDataSource() private method

Returns a row (ready to be added into the TableModel) derived from the given index in the data source.
private GetRowFromDataSource ( int index ) : Row
index int
return Row
        private Row GetRowFromDataSource(int index)
        {
            object row = dataManager.List[index];
            PropertyDescriptorCollection propColl = dataManager.GetItemProperties();

            Cell[] cells = new Cell[this.ColumnModel.Columns.Count];

            // Fill value for each column
            int i = 0;
            foreach (Column column in this.ColumnModel.Columns)
            {
                PropertyDescriptor prop = propColl.Find(column.Text, false);
                if (prop == null)
                    throw new ApplicationException(string.Format("Cannot find property '{0}' in datasource.", column.Text));

                object val = prop.GetValue(row);
                Cell cell = this.DataSourceColumnBinder.GetCell(column, val);
                cells.SetValue(cell, i);
                i++;
            }

            return new Row(cells);
        }
Table