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 | ....
That's an easy one:
layout.ColScrollRegions[0].SizingMode = SizingMode.Fixed;
You're right --- that was easy. Couldn't find anything related to that on the various documentation pages, though. Thankfully you knew about it.
I have one more issue. Now that I have scroll regions defined, one of the pieces of functionality that we have on our usage of WinGrid, is the ability to right-click on the grid and perform an "Export to Excel". The underlying code simply runs the following:
private Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter ugExcelExporter;
string fileName = directoryName + "\\Temp" + System.DateTime.Now.Ticks + ".xls";
ugExcelExporter.Export(this, fileName);
System.Diagnostics.Process.Start(fileName);
The problem is alll we get in our exported document is the first scroll region column. I know that the exporting function worked before I added the scroll regions, so there might be something we have to do to make the export work right when there are scrolling regions...
ColScrollRegions should never have any effect on exporting. Are you sure it's the ColScrollRegions that are causing this and not something else in your application? Maybe you are hiding the column in the other scroll regions for some reason?
BTW... if you are no longer using RowLayouts, why use ColScrollRegions? Fixed Headers are probably better, anyway.
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();
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.
'ov' is deinfed in the sample code I posted above... it's like 5 posts back.
I don't think there is a PDF version of the docs, but I'm not sure, so I pinged Developer Support to see if they can get you a definitive answer on that.
I didn't have a definition of the object 'ov' so I had to eliminate that from my code. this morning I did a search on it and found out that I needed to do a override call, so I then assumed that 'ov' was a ppointer to the override object that you forgot to include in your code sample.
So now I am all set with everything. thanks so much for all your help.
Is there a place where I can download a complete developers' guide in PDF format? I would be able to find most of what I need if I had that type of document.
I covered that in my previous post.
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,