ComponentOne Grid for WPF: Grid for WPF Task-Based Help > Controlling Grid Interaction > Preventing the Grid from Being Sorted

Preventing the Grid from Being Sorted

You can easily prevent the grid from being sorted by using the AllowSort property. By default the AllowSort property is set to True and sorting is allowed. By setting the AllowSort property False, you can prevent users from sorting the grid.

In XAML

Prevent users from sorting the grid at run time by adding AllowSort="False" to the <c1grid:C1DataGrid> tag so that it looks similar to the following:

<c1grid:C1DataGrid Name="C1DataGrid1" AllowSort="False">

In Code

Prevent users from sorting the grid at run time by adding the following code to your project:

      Visual Basic

C1DataGrid1.AllowSort = False

      C#

c1DataGrid1.AllowSort = false;

At Design Time

Prevent users from sorting the grid at run time by setting the AllowSort property False in the C1DataGrid's Properties window.


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