I can only see that this is possible in a WebGrid. Can anyone help to determine whether this is possible in a grid with a single band of data?
To elaborate, three of the column headers will be different geographical regions, and so I would like a header that spans above all the individual column headers that says "Regions".
I've been searching the forums and knowledge base but I can't see any clues - any help is much appreciated!
Thanks.
I'm on other part of the project i'll be back with this problem soon.
But i think what i've read help me.
Hello Steve,
I wanted to know if you were able to solve your issue based on these suggestions or you still need help. Please let me know.
Hi Steve,
The group header doesn't have any support for displaying a sort indicator. But you could sort on a column and have that column consider both columns by using a SortComparer on one or both of the columns.
Hi,
i try to use groups to span title for two colomn.
but is it possible to sort on groups?
Thanks!
Steve
This is a lot easier to do at design-time in the grid designer than in code. Using RowLayouts in code requires a lot of knowledge about how GridBagLayouts work.So if you can, I recommend binding the grid to the data source at design-time.
If your data structure does not exist at design-time, then you can still use the grid designer to establish the data schema manually. Just make sure that the band and column names all match up to the real data source you will be binding to at run-time and that you bind the grid using the SetDataBinding method.
The layout you have here is a pretty simple one, so you could do it in code if you really want to, but the designer would be a lot easier - it allows you to simply arrange things via drag and drop and using context menus.
The main problem with the code you have here is that the Group.Columns collection is only used for the Groups & Levels layout (Standard layout), not for a GroupLayout. So that's why your columns are not within the group.
Here's some quick sample code I threw together which seems to do what you want:
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { UltraGridLayout layout = e.Layout; UltraGridBand band = layout.Bands[0]; band.RowLayoutStyle = RowLayoutStyle.GroupLayout; UltraGridGroup group1; if (band.Groups.Exists("Group 1")) group1 = band.Groups["Group 1"]; else group1 = band.Groups.Add("Group 1"); band.Columns["Column 1"].RowLayoutColumnInfo.ParentGroup = group1; band.Columns["Column 2"].RowLayoutColumnInfo.ParentGroup = group1; // If you want the height of the column headers outside the group to // fill the entire height, you would add this code: //band.Columns["Column 3"].RowLayoutColumnInfo.SpanY = 4; //band.Columns["Column 4"].RowLayoutColumnInfo.SpanY = 4; //band.Columns["Column 3"].RowLayoutColumnInfo.LabelSpan = 4; //band.Columns["Column 4"].RowLayoutColumnInfo.LabelSpan = 4; }