ListView.AllowColumnReorder Property


Gets or sets a value indicating whether the user can drag column headers to reorder columns in the control.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

member AllowColumnReorder : bool with get, set

Property Value

Type: System.Boolean

true if drag-and-drop column reordering is allowed; otherwise, false. The default is false.

Setting the value of the AllowColumnReorder property has no effect unless the View property is set to Details. You can use this property to allow users to reposition columns in the control at run time. When the AllowColumnReorder property is set to true, users can position the columns in the control to display the item and its subitems in a way that meets their needs within your application.

The following code example creates a ListView control with three ListViewItem objects specified and three ListViewItem.ListViewSubItem objects specified for each item. The example also creates ColumnHeader objects to display the subitems in details view. Two ImageList objects are also created in the code example to provide images for the ListViewItem objects. These ImageList objects are added to the LargeImageList and SmallImageList properties. The example uses the following properties in creating the ListView control:

This example requires that you have added the code to a Form and call the method created in the example from the constructor or another method on the form. The example also requires that images named MySmallImage1, MySmallImage2, MyLargeImage1, and MyLargeImage2 are located in the root directory of drive C.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top