Log In
[Expand]General Information
[Collapse]WinForms Controls
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Collapse]Data Grid
   [Expand]Getting Started
   [Expand]Binding to Data
   [Collapse]Grid View
    [Collapse]Columns and Card Fields
     [Expand]Customization Form
      Tutorial: Column Resizing
      Tutorial: Best Fit Option
      Tutorial: Auto Width Mode
      Tutorial: Fixed Columns
      Tutorial: Column Reordering
      Tutorial: Column Visibility
      Tutorial: Column Chooser API
      Column and Card Field Overview
      Data Cells
      Column Width Options - Auto-Width, Best Fit and Auto-Fill Column
      Column Visibility
      Creating Columns and Binding Them to Data Fields
      Fixed Columns
    [Expand]Rows and Cards
    [Expand]Row, Column and Cell Access API
    [Expand]Split Presentation
    [Expand]Cell Merging
    [Expand]Row Preview Sections
   [Expand]View Technology
   [Expand]Data Editing
   [Expand]Filtering and Locating Rows
   [Expand]Focus and Selection Handling
   [Expand]Processing Rows
   [Expand]Formatting Cell Values
   [Expand]Master-Detail Relationships
   [Expand]Asynchronous Image Load
   [Expand]Export and Printing
   [Expand]Appearance and Conditional Formatting
   [Expand]Batch Modifications
   [Expand]Hit Information
   [Expand]Popup Menus
   [Expand]Saving and Restoring Layouts
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Expand]End-User Capabilities
    Included Components
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Map Control
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Report Server
[Expand]eXpressApp Framework
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Column Width Options - Auto-Width, Best Fit and Auto-Fill Column

This topic provides information on the Grid View features to customize column width.

Expanded Online Videos

  • Column Resizing
    Learn how to specify column width, and how to allow or prohibit end-user column resizing.
    Watch the Video

  • Best Fit Width
    The Best Fit option allows you to adjust column width to completely display its content.
    Watch the Video

  • Automatic Column Width Mode
    The grid can automatically adjust columns so that they occupy the entire view and the horizontal scrollbar is never required.
    Watch the Video

Expanded Column Width and Auto-Width Feature

Column visual widths are dependent on the column auto width feature. Consider the Grid View with the auto-width feature disabled (this is not the default behavior).

When you enable the auto-width feature (the View's GridOptionsView.ColumnAutoWidth option), visual widths of all columns are stretched (in proportions specified by their GridColumn.Width settings) to fit the View's width. If any column is resized, the total visual width does not change. Instead, the visual widths of other columns may be affected.

Use the GridColumn.VisibleWidth read-only property to get the column's actual visible width, in pixels. To learn how a column's GridColumn.Width property changes in auto-width mode in response to various operations, see the GridColumn.Width topic.

Expanded Best Fit

The best-fit feature calculates the "best" width for a column to fit the column's header and cell contents, taking any size constraints into account. End-users can apply best fit to a certain column using the Best Fit command from the Column Header Context Menu and by double-clicking the column header's right edge. The best fit functionality can also be applied to all columns at once, with the Best Fit (all columns) command from the Column Header Context Menu.

The best-fit functionality is based on the iteration through all rows by default. The following options are tailored to improve the control's performance when performing best-fit operations on large volumes of data: In code you can invoke best fit operations with the following methods:

Expanded Fixed Width in Auto-Width Mode and Best-Fit Operations

You can prevent certain columns from automatic width changes in column auto-width mode and best-fit operations by setting the OptionsColumn.FixedWidth option for these columns to true. End-users can still resize these columns at runtime unless the OptionsColumn.AllowSize option is disabled.

Expanded Auto-Fill Column

When the column auto-width feature (GridOptionsView.ColumnAutoWidth) is disabled, the total column width may be less than the View's width. In this case, the View displays an empty space to the right of the last visible column.

In this layout, you can select one column that automatically resizes to occupy this free space. This column is called an auto-fill column and can be set with the GridView.AutoFillColumn property.

Expanded See Also

How would you rate this topic?​​​​​​​