Infragistics2.Win.UltraWinListView.v8.1
AutoFitColumns Property
See Also  Example
Infragistics.Win.UltraWinListView Namespace > UltraListViewDetailsSettings Class : 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

Visual Basic (Declaration) 
Public Property AutoFitColumns As AutoFitColumns
C# 
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 UltraListView.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(ColumnAutoSizeMode) 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:

Visual BasicCopy Code
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
C#Copy Code
using Infragistics.Win;
using Infragistics.Win.UltraWinListView;

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

       listView.ViewSettingsDetails.AutoFitColumns = AutoFitColumns.ResizeAllColumns;
   }

See Also