Version

Auto-Fit Columns Using the AutoFitStyle Property

You can specify that the WinGrid™ automatically resizes the last column in each band in order to occupy all of the available horizontal space. You can do this by setting the AutoFitStyle property on the DisplayLayout to 'ExtendLastColumn'.

For more information on auto-fitting columns, see Auto-Sizing Columns and Rows.

To set the AutoFitStyle property:

  1. Right-click on the WinGrid and select UltraWinGrid Designer.

  2. In the designer on the right select the option called "Control Settings". Scroll down and expand the DisplayLayout property, then scroll down to AutoFitStyle. The AutoFitStyle enumeration provides three options:

    • None - Automatic resizing is disabled. This is the default value of the property.

    • ResizeAllColumns - Resizes all of the columns so that they occupy all of the visible area.

    • ExtendLastColumn - Resizes the last column in a band so that it occupies all of the visible area that is not occupied by the other columns.

The ExtendLastColumn setting does not have any effect when at least one of the following conditions is true:

  • Card-view functionality is enabled.

  • Horizontal ViewStyle is being used.

  • There are multiple column scroll regions.

Below is a screen shot of a WinGrid whose AutoFitStyle property is set to 'None':

auto fit columns using the autofitstyle property in ultragrid

If the AutoFitStyle property were set to 'ExtendLastColumn', the WinGrid would look like this:

auto fit columns using the autofitstyle property in wingrid