I have a problem with the way ColumnGrouping is handling a GridViewTextBoxColumn. I have recreated the problem in a very simple code snippet. I am attaching a screen image of how it is rendered and the code that populates the table.
What am I doing wrong?
radGridView1.Visible = false;
radGridView1.Columns.Clear();
radGridView1.Rows.Clear();
radGridView1.SummaryRowsTop.Clear();
radGridView1.Refresh();
//radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
// Handle Planning Group definitions if provided.
ColumnGroupsViewDefinition ColView = new ColumnGroupsViewDefinition();
ColView.ColumnGroups.Add(new GridViewColumnGroup("SYSTEM"));
ColView.ColumnGroups.Add(new GridViewColumnGroup("DETAILS"));
ColView.ColumnGroups[0].Rows.Add(new GridViewColumnGroupRow());
ColView.ColumnGroups[1].Rows.Add(new GridViewColumnGroupRow());
radGridView1.TableElement.BeginUpdate();
GridViewTextBoxColumn gt = new GridViewTextBoxColumn("System");
//gt.MaxLength = 40;
gt.AutoSizeMode = BestFitColumnMode.None;
radGridView1.MasterTemplate.Columns.Add(gt);
ColView.ColumnGroups[0].Rows[0].Columns.Add(radGridView1.Columns["System"]);
for (int x=1; x<10; x++)
{
radGridView1.MasterTemplate.Columns.Add(new GridViewDecimalColumn(x.ToString()));
ColView.ColumnGroups[1].Rows[0].Columns.Add(radGridView1.Columns[x.ToString()]);
}
radGridView1.ViewDefinition = ColView;
// Add data rows
for (int y=1; y<20; y++)
{
// Populate the columns for this system
object[] columns = new object[10]; // Allocate a new array
columns[0] = "System"+y.ToString();
for (int c=1; c<10; c++)
{
columns[c] = Convert.ToDecimal(y*c);
}
radGridView1.Rows.Add(columns);
}
// Done populating grid
radGridView1.TableElement.EndUpdate();
radGridView1.Columns[0].IsPinned = true;
radGridView1.Columns[0].PinPosition = PinnedColumnPosition.Left;
radGridView1.Refresh();
radGridView1.Visible = true;