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
2114
AutoSize or not Autosize?
posted

I would like to auto-set the size of a combo column (as is the only one visible in the combo) to be at least equal to the combo actual Width, but not less equal that the tallest string in that column rows.

How to do it?

 

My code actually:

  Private Sub cmb_InitializeLayout(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles cmbObject.InitializeLayout

    Dim combo As UltraCombo = TryCast(sender, UltraCombo)

    If combo IsNot Nothing AndAlso combo.DisplayLayout.Bands.Count > 0 Then
      If combo.DisplayLayout.Bands(0).Columns.Count > 1 Then
        combo.DisplayLayout.Bands(0).Columns(0).Hidden = True
        combo.DisplayLayout.Bands(0).Columns(1).PerformAutoResize(PerformAutoSizeType.AllRowsInBand)
      End If
    End If

  End Sub

Parents
  • 469350
    Offline posted

    Instead of PerformAutoSize, you can use the CalculateAutoResizeWidth method. This method does essentially the same thing as PerformAutoSize, except that it does not change the Width of the column - it just returns the Width to you.

    Then you can set the Width of the column to the Max of the returned width and the width of the control.

Reply Children