I have a GridView that gets GridColumns added to it dynamically. At design time, I don't know how many columns the view is going to have.
What I currently do to format each of these dynamically added columns, is format them in a foreach after the datasource of the grid has been set:
foreach (GridColumn gridColumn in gridView.Columns)
{
gridColumn.AppearanceCell.Options.UseTextOptions = true;
gridColumn.AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
gridColumn.AppearanceHeader.Options.UseTextOptions = true;
gridColumn.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Near;
gridColumn.AppearanceHeader.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap;
gridColumn.OptionsColumn.AllowGroup = DevExpress.Utils.DefaultBoolean.False;
gridColumn.OptionsColumn.AllowIncrementalSearch = false;
gridColumn.OptionsColumn.AllowMerge = DevExpress.Utils.DefaultBoolean.False;
gridColumn.OptionsColumn.AllowMove = false;
gridColumn.OptionsColumn.AllowSort = DevExpress.Utils.DefaultBoolean.False;
gridColumn.OptionsColumn.AllowEdit = false;
}
The problem is I may have a large number of columns and this foreach is slowing down my initial drawing. Isn't there a way to decide, for the GridView, how each of its columns are going to look, whether they have been added yet or not?