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

Tutorial: Column Reordering

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

Expanded Default Behavior

By default, the GridView allows end-users to reorder columns by simply dragging their headers. The same drag-and-drop functionality is available to you in the Visual Studio designer.

Expanded Specifying Column Position

You can also specify a column's position using its GridColumn.VisibleIndex property.

Expanded Restricting End-User Capabilities

Header drag and drop is enabled for all columns by default. To disable it for a particular column, use the OptionsColumn.AllowMove option. Note though that this column's position can change if you move other columns. If you want to completely disable column reorder within the view, use the View’s GridOptionsCustomization.AllowColumnMoving option available under GridView.OptionsCustomization.

Expanded Responding to Column Order Changes

If you need to respond to column order changes at runtime, handle the View's ColumnView.ColumnPositionChanged event. In the handler, identify the column that was moved using the Sender parameter. Then, display the caption of that column and the Category's column index.

Run the application and move one of the columns. Notice the Category column's position displayed in the status bar.

Now move a column over Category. You'll now see how one column reordering operation can actually affect other columns.

Expanded See Also

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