ComponentOne Grid for WPF: Grid for WPF Task-Based Help > Controlling Grid Interaction > Preventing a Column from Being Reordered

Preventing a Column from Being Reordered

ComponentOne Grid for WPF allows users to easily reorder columns through a drag-and-drop operation. You can easily prevent specific columns in the grid from being reordered by using the AllowColumnMove property. By default the AllowColumnMove property is set to True and reordering columns is allowed. By setting the AllowColumnMove property False, you can prevent users from reordering a column in the grid.

In XAML

Prevent users from reordering the ProductName column at run time by adding AllowColumnMove="False" to the <c1grid:Column> tag so that it looks similar to the following:

<c1grid:Column PropertyName="ProductName" Caption="Name" AllowColumnMove="False"/>

In Code

Prevent users from reordering the ProductName column at run time by adding the following code to your project:

      Visual Basic

C1DataGrid1.Columns("ProductName").AllowColumnMove = False

      C#

c1DataGrid1.Columns["ProductName"].AllowColumnMove = false;


Send comments about this topic to ComponentOne.
Copyright © 1987-2010 ComponentOne LLC. All rights reserved.