Version

AutoFitColumns Property

Gets/sets whether the widths of all columns are automatically calculated so that they occupy all available horizontal space, preventing a horizontal scrollbar from appearing.
Syntax
'Declaration
 
Public Property AutoFitColumns As AutoFitColumns
public AutoFitColumns AutoFitColumns {get; set;}
Remarks

When AutoFitColumns is set to true, no horizontal scrollbar appears, and the column widths are negotiated so that all columns fit horizontally inside the viewable area of the control. When a column is resized, either programmatically or by the end user, that column's actual width is preserved whenever possible in subsequent calculations. For example, if the width of the MainColumn is changed by the end user, that actual size is used for that column the next time the control is painted, and the widths of the remaining columns are scaled up or down depending on the available horizontal space. Note that this scaling will never reduce the width of a column to the point where it becomes inaccessible, i.e., a minimum width is enforced.

In the case where the UltraListViewColumnBase.PerformAutoResize is called on a column, and the resulting width is larger than the difference between the width of the control and the sum of the minimum widths of the remaining columns, the automatically calculated width is negotiated to a value that allows all remaining columns to be displayed at their minimum width.

Example
The following code sample demonstrates how to use the AutoFitColumns property to make all columns displayed in 'Details' view visible, thus preventing a horizontal scrollbar from appearing:

Imports Infragistics.Win
Imports Infragistics.Win.UltraWinListView


    Private Sub EnableAutoFitColumns(ByVal listView As UltraListView)
        If ListView Is Nothing Then Throw New ArgumentNullException("listView")

        listView.ViewSettingsDetails.AutoFitColumns = AutoFitColumns.ResizeAllColumns
    End Sub
using Infragistics.Win;
using Infragistics.Win.UltraWinListView;

    private void EnableAutoFitColumns( UltraListView listView )
    {
        if ( listView == null )
            throw new ArgumentNullException( "listView" );

        listView.ViewSettingsDetails.AutoFitColumns = AutoFitColumns.ResizeAllColumns;
    }
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also