Hello!
I would like to merge two column headers into one. I am not binding my datasource at design time so I guess that I need to merge the headers in code?
I found a lot of posts about this topic but everything seems to deal with this in design time.
What can I do?
/Henrik
Yes, it is possible.
Please take a look on the modifications that I made in the sample
Ok.
Are there any possibilities to merge "Column 1" and "Column 2" to one Column?
In your example, you add an extra header row above the existing.
In my case, I have a small image column that I want to merge with the text column. I faced some filtering problem when using images in the filter column, so I am trying this approach.
Screenshot
Hello Henrik,
Here is small sample:
ultraGrid1.Dock = DockStyle.Fill;
DataTable dt = new DataTable();
dt.Columns.Add("Column 1");
dt.Columns.Add("Column 2");
dt.Columns.Add("Column 3");
dt.Rows.Add("1", "2", "3");
ultraGrid1.DataSource = dt;
UltraGridBand band = ultraGrid1.DisplayLayout.Bands[0];
band.RowLayoutStyle = RowLayoutStyle.GroupLayout;
UltraGridGroup group = band.Groups.Add("MyGroup", "MyGroup");
band.Columns["Column 1"].RowLayoutColumnInfo.ParentGroup = group;
band.Columns["Column 2"].RowLayoutColumnInfo.ParentGroup = group;
band.Columns["Column 1"].RowLayoutColumnInfo.PreferredCellSize = new System.Drawing.Size(0, 18);
band.Columns["Column 1"].RowLayoutColumnInfo.SpanX = 2;
band.Columns["Column 1"].RowLayoutColumnInfo.SpanY = 4;
band.Columns["Column 2"].RowLayoutColumnInfo.PreferredCellSize = new System.Drawing.Size(0, 18);
band.Columns["Column 2"].RowLayoutColumnInfo.SpanX = 2;
band.Columns["Column 2"].RowLayoutColumnInfo.SpanY = 4;
band.Columns["Column 3"].RowLayoutColumnInfo.PreferredCellSize = new System.Drawing.Size(0, 18);
band.Columns["Column 3"].RowLayoutColumnInfo.PreferredLabelSize = new System.Drawing.Size(0, 48);
band.Columns["Column 3"].RowLayoutColumnInfo.SpanX = 2;
band.Columns["Column 3"].RowLayoutColumnInfo.SpanY = 4;
Please take a look on attached sample for more details