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
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
Screenshot
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.
Yes, it is possible.
Please take a look on the modifications that I made in the sample
Sample 2
About your issue with image filtering, Please take a look on that forum thread http://www.infragistics.com/community/forums/p/63594/322717.aspx There you could find small sample.
Let me know if you have any questions
I will have a look at this. Thanks!
One question regarding this. When I use this sample code, I understand that I am actuallt hiding my existing column headers and adding new ones instead.
The problem is that I am loosing all the standard formatting of the headers. Should it be like that.
I am using the Infragistics Appstyling and everything just becomes plain...
/H
Hi Zlatan,
There's no reason why the Application Style Library should no affect any column headers. But I tried this out using Georgi's sample and I get the same results.
This is because the new header is not a column header - it's a Group Header. And the isl file that I picked (IG.Isl) apparently doesn't style the group headers. So what you have to do is modify your isl and update the GroupHeader role with the same appearance as the ColumnHeader role.
OK!
Is there any way to do this merge operation directly on the column headers, instead of these "group headers"?
What I want to do is to merge two columns into one, nothing else. I have a UltraCombo with two columns...
My software makes it possible to use all isl files available, and then I will have to modify all of them...