Imports Infragistics.Win
Imports Infragistics.Win.UltraWinListView
' Set the AutoSizeMode property of the MainColumn to 'VisibleItemsAndHeader',
' so that when the end user double-clicks the right edge of the header, the
' width of the column is adjusted so as to fully display the text of all
' visible items, as well as the header's caption.
Me.ultraListView1.MainColumn.AutoSizeMode = ColumnAutoSizeMode.VisibleItemsAndHeader
' Call the PerformAutoResize method to programmatically resize the column
Me.ultraListView1.MainColumn.PerformAutoResize(Me.ultraListView1.MainColumn.AutoSizeMode)
' Set the ColumnAutoSizeMode property of the UltraListViewDetailsSettings
' object (returned by the control's ViewSettingsDetails property) to a combination
' of the 'Header' and either 'VisibleItems' or 'AllItems' bits, depending on whether
' there are a relatively large number of items being displayed.
Dim autoSizeMode As ColumnAutoSizeMode = ColumnAutoSizeMode.Header
If (Me.ultraListView1.Items.Count >= LARGE_ITEM_COUNT) Then
autoSizeMode = autoSizeMode Or ColumnAutoSizeMode.VisibleItems
Else
autoSizeMode = autoSizeMode Or ColumnAutoSizeMode.AllItems
End If
Me.ultraListView1.ViewSettingsDetails.ColumnAutoSizeMode = autoSizeMode