More specifically, when I call
it doesn''t change the table''s appearance, as expected. However when I call:
It removes all the columns from the table and just adds that one.
ADAdministrator Syncfusion Team July 21, 2004 08:03 AM
regarding your sample:
Before you add
int count = gridGroupingControl1.TableDescriptor.Columns.Count; // forces auto population
gridGroupingControl1.TableDescriptor.Columns.IsModified = true; // forcess keeping all auto-populated columns
That way you signal the grid that you want to keep the auto-populated set of columns as it is and start modifying the collection. If it is not marked modified the columns collections assumes you do not want to keep the auto-populated set of columms.
Once the columns collection was marked modified it will not autopopulate any more. You will need to manually add fields to the columns collection after that.
Check out the GridTableDescriptor overview in class reference. (Should be at ms-help://Syncfusion.EssentialSuiteClassRef/Syncfusion.EssentialSuiteClassRef/Syncfusion.Grid.Grouping~Syncfusion.Windows.Forms.Grid.Grouping.GridTableDescriptor.html)
The Fields collection is auto-populated from the underlying sourcelists columns. Normally you will not modify this collection and just use it in its default auto-populated state. A fieldDescriptor holds a name, mapping name and type of the column in the list.
The Columns collection lets you specify the fields that should be displayed in the GridTableControl. By default the Columns collection is auto-populated from the underlying Fields and ExpressionFields collection and will be a combination of this two collection. When the Columns collection is autopopulated and you make changes to the Fields or ExpressionFields collection this changes will automatically be reflected in this collection.
GridColumnDescriptors in the Columns collection have a reference to a FieldDescriptor (or ExpressionFieldDescriptor).
Additionally GridColumnDescriptors contain grid-specific information about a column such as the column width. You can manually set the column width or have it be automatically initialized by the grid to fit the string with the maximum length in the columns data. GridColumnDescriptor also has a Appearance property. This is where cell type and formatting of the column can be specified.