[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
   Reporting
  [Collapse]Data Grid
   [Expand]Getting Started
   [Expand]Implementation Details
   [Collapse]Views
    [Collapse]Table View
      Columns Layout and Width
      Fixed Columns and Bands
    [Expand]Card View
     TreeList View
     Creating and Assigning Views
   [Expand]Grid View Data Layout
   [Expand]Binding to Data
   [Expand]Master-Detail Data Representation
   [Expand]Data Editing and Validation
   [Expand]Grouping
   [Expand]Filtering and Searching
   [Expand]Sorting
   [Expand]Data Summaries
   [Expand]Paging and Scrolling
   [Expand]Focus and Navigation
   [Expand]Selection
   [Expand]Drag-and-Drop
   [Expand]Conditional Formatting
   [Expand]Appearance Customization
   [Expand]MVVM Enhancements
   [Expand]Printing and Exporting
   [Expand]End-User Interaction
   [Expand]Miscellaneous
   [Expand]Performance Improvement
   [Expand]Design-Time Features
   [Expand]Visual Elements
   [Expand]End-User Capabilities
   [Expand]Examples
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Printing-Exporting
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Gantt Control
  [Expand]Diagram Control
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Columns Layout and Width

The DXGrid control provides two options that, if enabled, allow end-users to modify the layout of columns within a Table View. The DataViewBase.AllowColumnMoving option controls whether end-users can change the visible position of columns via drag and drop. The TableView.AllowResizing option controls whether end-users can resize columns by dragging the right edge of their headers.

Individual columns provide the BaseColumn.AllowMoving and BaseColumn.AllowResizing options that, if specified, take priority over the view's corresponding options. For instance, you can prevent individual columns from being moved by an end-user.

Expanded Column Position

Columns are identified by their headers. Column headers are displayed if the view's DataViewBase.ShowColumnHeaders property is set to true.

By default, columns are displayed within a view in the same order they appear in the GridControl.Columns collection. If column moving is allowed, end-users can reorder columns by dragging their headers.

To move a column in code, use the DataViewBase.MoveColumnTo method.

To hide a column, set its BaseColumn.Visible property to false. End-users can temporarily hide individual columns via the Column Chooser. To learn more, see Showing and Hiding Columns.

Expanded Column Width

Column widths can be changed automatically, so that the total columns' width matches the grid's width. In this instance, changing the width of one column automatically changes the widths of other columns. This behavior is controlled by the view's TableView.AutoWidth property. To obtain the actual width of columns, use their BaseColumn.ActualWidth property.

To prevent the width of an individual column(s) from being changed when resizing other columns, you should set its BaseColumn.FixedWidth property to true. Use the BaseColumn.MinWidth property to specify the minimum width.

If the automatic column width calculation is disabled, a column's width is specified by its BaseColumn.Width property. Grid columns support both absolute and proportional (star) width value. If the total column width exceeds the grid's width, a horizontal scrollbar is displayed, allowing an end-user to scroll grid columns. If you want a column (or columns) to always be displayed onscreen, regardless of scrolling, set its BaseColumn.Fixed property. For detailed information, see Fixed Columns and Bands.

Proportional column sizing.

WPF Data Grid allows you to define the proportional (star) column size. Available space is distributed among columns by weighted proportions similar to the "star sizing" mechanism used by the MS Data Grid.

Note

The proportional sizing and TableView.AutoWidth work only when the GridControl has a finite width.

The code sample below demonstrates how to define proportional column width.

Note

The proportional sizing does not work in column bands.

Expanded Best Fit

Table Views provide the capability to automatically calculate and apply the optimal width required for a column to completely display its contents. Refer to the Best Fit topic to learn more.

Is this topic helpful?​​​​​​​