How can I setup a view only grid that has several fixed width columns and only have the first column autosize to fit the width of the grid? I've tried several things but nothing works.
An example of what I've tried, I want the name column to autosize to fit the grid width and have all the other columns fixed width:
Private Sub UltraGrid1_InitializeLayout(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles UltraGrid1.InitializeLayout Dim c As UltraGridColumn e.Layout.AutoFitStyle = AutoFitStyle.ResizeAllColumns For Each c In e.Layout.Bands(0).Columns c.CellActivation = Activation.NoEdit c.AllowRowFiltering = DefaultableBoolean.False Select Case c.Key.ToLower Case "name" c.Header.Caption = "Campaign" Case "type_name" c.Header.Caption = "Type" c.Width = 80 c.LockedWidth = True Case "date_lastrun" c.Header.Caption = "Last Run" c.Width = 80 c.LockedWidth = True Case "date_nextrun" c.Header.Caption = "Next Run" c.Width = 80 c.LockedWidth = True Case "service_codes_type_name" c.Header.Caption = "Codes Type" c.Width = 120 c.LockedWidth = True Case Else c.Hidden = True End Select Next
End Sub
I think what you want to do here is set the MinWidth and MaxWidth on all of the "fixed-width" columns. The you can use the AutoFitStyle property to make the one sizable column fill the rest of the available space.
Try to write this after the For Each for the column you want to resize:
column.PerformAutoResize(PerformAutoSizeType.AllRowsInBand, true)