/// <summary> /// Automatic create the columns classes based on the specified DataSource. /// </summary> public void CreateColumns() { Columns.Clear(); if (DataSource != null) { int i = 0; if (FixedColumns > 0) { Columns.Insert(i, DataGridColumn.CreateRowHeader(this)); i++; } foreach (System.Data.DataColumn col in DataSource.Table.Columns) { Columns.Insert(i, DataGridColumn.Create(this, col, DataSource.AllowEdit)); i++; } } }
/// <summary> /// Automatic create the columns classes based on the specified DataSource. /// </summary> public void CreateColumns() { Columns.Clear(); if (DataSource != null) { int i = 0; if (FixedColumns > 0) { Columns.Insert(i, DataGridColumn.CreateRowHeader(this)); i++; } foreach (System.ComponentModel.PropertyDescriptor prop in DataSource.GetItemProperties()) { DataGridColumn col = Columns.Add(prop.Name, prop.DisplayName, SourceGrid.Cells.DataGrid.Cell.Create(prop.PropertyType, !prop.IsReadOnly)); } } }
/// <summary> /// Automatic create the columns classes based on the specified DataSource. /// </summary> public virtual void CreateColumns() { Columns.Clear(); if (DataSource != null) { int i = 0; //[email protected]: changed fixedColumns to headerColumnCount for FreezePanes enhancement. if (HeaderColumnCount > 0) { Columns.Insert(i, DataGridColumn.CreateRowHeader(this)); i++; } foreach (System.ComponentModel.PropertyDescriptor prop in DataSource.GetItemProperties()) { Columns.Add(prop.Name, prop.DisplayName, SourceGrid.Cells.DataGrid.Cell.Create(prop.PropertyType, !prop.IsReadOnly)); } } }