I have successfully implemented column groups in my wingrid via the row layouts. Now that I've done that, I need to freeze the first group (containing the first two data columns) so as I scroll horizontally that group stays put.
I've tried everything I can think of based on what I've found in your forum, but nothing seems to work. Since I have three grouped headings, I had to create two groups for the first two columns. One is the parent of the other. The groups are named GC_Empty and Empty and contain data columns 1 and 2 (column 0 is hidden). So I assumed that I would do one of the following (or both)
1. GC_Empty.Header.Fixed = true;
Empty.Header.Fixed = true;
2. band.Columns[1].Header.Fixed = true;
band.Columns[2].Header.Fixed = true;
Then afterwards: ugManagers.DisplayLayout.Override.FixedCellSeparatorColor = Color.Red;
Thanks in advance,
Paul
Hi Paul,
Fixed headers and RowLayouts are mutually exclusive. There is no way to fix a header in RowLayout mode.
If you have nested groups, then there's not much you can do. But if you are only using a single row of groups with some columns in each group in a flat layout, you could use the normal Groups and levels view (RowLayoutStyle == None).
Hmmmm. I do have two groups. Each has 6 3-column groups under it. Don't know if that qualifies as nested, but I think it might. Could I do this kind of thing without having to use RowLayout? Then I could use the standard group freezing.
Here's what I have:
| Major Group 1 | Major Group 2 |
| Minor Group 1 | Minor Group 2 | Minor Group x | Minor Group 1 | Minor Group 2 | Minor Group x |
|col1 | col2 | col3 | ....
There isn't any column hiding. Before I did the scroll regions, I was able to do the export and get all the columns. now I only get the first one. I am forcing the first column to be exclusive to the first scroll region, maybe that's where the problem is?
I was under the impression that the only way to allow for scrolling such that the first x number of columns would stay stationary was by way of scrolling regions.
Hi,
ColScrollRegions are the old way to do it. We added true fixed header support a few years back. All you have to so is set UseFixedheaders to true and then you can set the Fixed property on the Group Header to true to fix a group. By default, the user can change the fixed state of a group, but you can turn this off by setting FixedHeaderIndicator to None. In fact, that was the original usage in the first post in this thread. :)
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { UltraGridLayout layout = e.Layout; UltraGridBand band = layout.Bands[0]; UltraGridOverride ov = layout.Override; layout.UseFixedHeaders = true; ov.FixedHeaderIndicator = FixedHeaderIndicator.None; band.Groups[0].Header.Fixed = true; }
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
{
UltraGridLayout layout = e.Layout;
UltraGridBand band = layout.Bands[0];
UltraGridOverride ov = layout.Override;
layout.UseFixedHeaders = true;
ov.FixedHeaderIndicator = FixedHeaderIndicator.None;
band.Groups[0].Header.Fixed = true;
}
Anyway, just to double check, I tried creating a small sample project with a grid with two ColScrollRegions and a column set to ExclusiveColScrollRegion on the first one and then I exported it to Excel. Like I thought, the ColScrollRegions have no effect on exporting.
I think there might have been a bug where this used to happen, but it was fixed a really long time ago. Are you using a very old version of the controls?
If that is the case, you could work around it by just removing the ColScrollRegion stuff from the export layout:
private void ultraGridExcelExporter1_ExportStarted(object sender, Infragistics.Win.UltraWinGrid.ExcelExport.ExportStartedEventArgs e) { foreach (UltraGridBand band in e.Layout.Bands) { foreach (UltraGridGroup group in band.Groups) { group.Header.ResetExclusiveColScrollRegion(); } foreach (UltraGridColumn column in band.Columns) { column.Header.ResetExclusiveColScrollRegion(); } } e.Layout.ColScrollRegions.Clear(); }
private void ultraGridExcelExporter1_ExportStarted(object sender, Infragistics.Win.UltraWinGrid.ExcelExport.ExportStartedEventArgs e)
foreach (UltraGridBand band in e.Layout.Bands)
foreach (UltraGridGroup group in band.Groups)
group.Header.ResetExclusiveColScrollRegion();
foreach (UltraGridColumn column in band.Columns)
column.Header.ResetExclusiveColScrollRegion();
e.Layout.ColScrollRegions.Clear();
Mike,
That final response put everything into proper focus. I hadn't noticed that there was a separate "UseFixedHeaders" for the entire WinGrid layout, and then a column-specific band.Groups[0].Header.Fixed = true; In my mind they were one and the same. Compound that with the explanation associated with the ColumnScrollRegion that I found on your forum some where, and to my mind you couldn't have the desired scrolling effect any other way.
I was getting different pointers because you still have documentation about scroll regions. I didn't notice if there was a discalimer about which version it referenced.
I just changed my WinGrid to use Fixed headers and everything works great. I can even export to Excel without any problems.
band.Groups[1].Header.Fixed = false;
Finally, is it necessary for the pushpin icons to be along each group? I would rather not have them display since the user won't be switching from fixed to unfixed...
Thanks,
I covered that in my previous post.
Please let us know if you require further assistance regarding the creating of a fixed grid (Greezing Groups in UltraGrid). We will be happy to assist you further.