ComponentOne DataGrid for WPF and Silverlight
Enabling Column Freezing
DataGrid for WPF and Silverlight Overview > DataGrid Features > Freezing > Enabling Column Freezing

You may want to freeze columns in the grid at run time so that they are always visible even when the grid is scrolled horizontally. For more information, see Freezing Columns. This feature is not enabled by default, but if you choose you can enable the column freezing feature by setting the CanUserFreezeColumns property to Left.

At Design Time

To enable column freezing, complete the following steps:

  1. Click the C1DataGrid control once to select it.
  2. Navigate to the Properties window and locate the CanUserFreezeColumns property.
  3. Click the drop-down arrow next to the CanUserFreezeColumns property and select Left.

In XAML

For example to enable column freezing, add CanUserFreezeColumns="Left" to the <c1:C1DataGrid> tag so that it appears similar to the following:

<c1:C1DataGrid Name="c1datagrid1" Height="180" Width="250" CanUserFreezeColumns="Left" />

In Code

For example, to enable column freezing, add the following code to your project:

Visual Basic
Copy Code
Me.C1DataGrid1.CanUserFreezeColumns = DataGridColumnFreezing.Left
C#
Copy Code
this.c1DataGrid1.CanUserFreezeColumns = DataGridColumnFreezing.Left;

 

What You've Accomplished

Run the application and observe that the freeze bar is visible at run time. The freeze bar can be moved to select which columns to freeze; columns to the left of the bar will be frozen so that they are always visible even when the grid is scrolled horizontally. For more information about column freezing, see the Freezing Columns topic.