Partager via


DataGrid.ColumnReordering Event

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Occurs before a DataGrid column moves to a new position in the display order.

Namespace:  System.Windows.Controls
Assembly:  System.Windows.Controls.Data (in System.Windows.Controls.Data.dll)

Syntax

'Declaration
Public Event ColumnReordering As EventHandler(Of DataGridColumnReorderingEventArgs)
public event EventHandler<DataGridColumnReorderingEventArgs> ColumnReordering
<sdk:DataGrid ColumnReordering="eventhandler"/>

Remarks

You can handle this event to customize the visual display of a column header drag-and-drop operation, or to replace the default drag-and-drop behavior completely. To customize the appearance of the dragged column header and the drop location indicator, set the DragIndicator and DropLocationIndicator properties. To replace the default behavior completely, set the Cancel property to true and then provide your own drag-and-drop implementation.

NoteNote:

When you set the Cancel property to true, the ColumnHeaderDragStarted, ColumnHeaderDragDelta, ColumnHeaderDragCompleted, and ColumnReordered events do not occur.

Users can change the column order by dragging column headers only if the CanUserReorderColumns property is true.

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.