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://es.infragistics.com/community/forums/p/63594/322717.aspx There you could find small sample.
Let me know if you have any questions
Hi Henrik,
I'm not sure. It looks like it's just the way to the layout comes out when you have groups. I doubt there is anything you can do to change that.
Mike, you don't have any idea where this gap comes from...?
Alright, I have proceeded according to Mike's suggestion and it works almost as planned.
I found the Group Header in the .isl file and I simply cloned every setting I found.
The red arrow shows a "white" gap between the grey border and the group header. How can I get rid of that?
I tried to modify the labelInsets but without success. They were already on zero.
However, I have one small question left.
Hello Zlatan,
You could use ColumnLayout instead , this will allows you to create column header which overlaps columns that you should merge, so the Application Style Library will style this header correctly and you should note that this what be the same as using of groups. And I still believe that Mike approach is better, you should managed the isl file instead to change your code . Changes in code involves a lot of testing and they hides some risk. So if I were on you I defiantly will use Mike’s approach.
I hope that this will helps you.
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...