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
1105
PerformAutoResize method
posted

I'm a little stumped, hoping for some guidance.

In my UltraWinGrid, I'm making use of the PerformAutoResize method after my data load because I like the functionality of having all columns resize themselves to fit the largest cell (and header) value.  However, this often results in extra unused space to the right of the last column.

Browsing through the properties, I stumbled on to the AutoFitStyle property, specifically the "ExtendLastColumn" option which is ideally like to have happen.

However, I can't seem to make the two approaches work.  What I want is a combination of "resize every column with regards to it's cell and header values...except the last column which should disregard it's autosize value and extend to the end of the grid".

Is there a way to do that?  It seems like I can only do one or the other.

Thanks!

Chris Rowland

Parents
  • 469350
    Offline posted

    Hi Chris,

    What's not working? I tried this out and it seems like it works okay to me. It's probably a good idea to do the resizing before you set the AutoFitStyle. Or, if you do it the other way, don't try to autosize the last column.


            private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
            {
                UltraGridLayout layout = e.Layout;
                UltraGridBand band = layout.Bands[0];

                foreach (UltraGridColumn column in band.Columns)
                {
                    column.PerformAutoResize(PerformAutoSizeType.AllRowsInBand, AutoResizeColumnWidthOptions.All);
                }

                layout.AutoFitStyle = AutoFitStyle.ExtendLastColumn;
            }

Reply Children
No Data