Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [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]Scrolling
   [Expand]View Technology
   [Expand]Grouping
   [Expand]Sorting
   [Expand]Summaries
   [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]Hints
   [Expand]Popup Menus
   [Expand]Saving and Restoring Layouts
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Expand]Examples
   [Expand]End-User Capabilities
    Included Components
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [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]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Tutorial: Column Resizing

This walkthrough is a transcript of the Column Resizing video available on the DevExpress YouTube Channel.

Expanded Default Behavior

By default, end-users can resize any grid column at runtime by dragging that column's right edge. The same functionality is also available to you in Visual Studio.

Expanded Specifying Column Width

You can also access column settings via the Property grid and change the GridColumn.Width property value.

Expanded Restricting End-User Capabilities

If you don't want end-users to resize a column, toggle that column's OptionsColumn.AllowSize option. You will see that the column's right edge can no longer be dragged. If you want to disable column resizing for all column in the GridView, use the View's GridOptionsCustomization.AllowColumnResizing option available under GridView.OptionsCustomization.

Expanded Responding to Column Width Changes

To respond to column width changes, handle the View's GridView.ColumnWidthChanged event. The sample code in our example first checks if the resized column is “Unit Price”. Then, it sets column text formatting and uses the column's new width to specify whether to display or hide decimal places.

Run the app and resize the column to see that code works as expected.

Expanded See Also

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