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
540
WinGrid Column Auto Sizing Confusing
posted

I've got a grid with about 30 columns.  I do not want to use AutoFItStyle > Resize All Columns, because it crunches up the columns and makes them unreadable.  Do to the amount of data users will have to scroll.  But what I'd at least like to do is display the grid with the columns auto sized to the content of the cell or header depending on which is wider.  After reading help and the forums it's not clear what settings I need to use.  Please advise.

  • 469350
    Verified Answer
    Offline posted


            private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
            {
                e.Layout.PerformAutoResizeColumns(false, PerformAutoSizeType.AllRowsInBand);
            }

    The method I am using here only exists in the latest version. If you are using an older version, then you have to loop through each band and column and call PerformAutoResize on each column.