Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1365
Column header size depends on content in cells?
posted

Dear infragistics,

I have an ultraGrid (Infragistics Winform UltraGrid 12.1 with latest update) and I've manually made a data schema in the grid's designer.

I've proceeded to make a Row Layout for Band 0 like: Standard View = true, Keep Headers With Cells = true, Label Position = Left. And I've only inserted 1 column (eventually) to get the grid to do what I want. Because...

It seems it's sizing the header of the column to the content of the cell. Which is wanted in most circumstances. But in my case I have the Label Position to the Left, so I want the header to size to it's own caption.

InitializeLayout looks like:

            Infragistics.Win.UltraWinGrid.UltraGrid grid = (Infragistics.Win.UltraWinGrid.UltraGrid)sender;

            grid.DisplayLayout.Override.AllowUpdate = Infragistics.Win.DefaultableBoolean.False;
            grid.DisplayLayout.Override.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.RowSelect;
            grid.DisplayLayout.Override.SelectTypeRow = Infragistics.Win.UltraWinGrid.SelectType.Single;
            grid.DisplayLayout.PerformAutoResizeColumns(true, Infragistics.Win.UltraWinGrid.PerformAutoSizeType.AllRowsInBand);

            Infragistics.Win.UltraWinGrid.UltraGridLayout layout = e.Layout;
            Infragistics.Win.UltraWinGrid.UltraGridOverride ov = layout.Override;

            ov.AllowColSizing = Infragistics.Win.UltraWinGrid.AllowColSizing.Free;

            foreach (var band in layout.Bands) {
                foreach (var col in band.Columns) {
                    col.PerformAutoResize(Infragistics.Win.UltraWinGrid.PerformAutoSizeType.AllRowsInBand);
                }

            }

I've included the file "longheader.png" to show what the problem is. Then when you doubleclick on the seperator on the right side of the header it actually snaps back to the size that i want, which you can see at "shortheader.png".

See, i've set AllowColSizing to Free. Doesn't work. I've set Runtime Label Sizing in the Rowlayout to None. Doesn't work. Can it be done? and how?

Thank you in advance for answering.

longshortheader.zip
Parents Reply Children
No Data