DataGrid for WPF and Silverlight Overview / DataGrid Features / Editing / Editing Cells / Disabling Cell Editing
Disabling Cell Editing

By default end users edit content in the grid at run time. For more information, see Editing Cells. If you choose, however, you can disable the cell editing feature by setting the C1DataGrid.CanUserEditRows property to False.

At Design Time

To disable cell editing, complete the following steps:

  1. Click the C1DataGrid control once to select it.
  2. Navigate to the Properties window and locate the CanUserEditRows property.
  3. Clear the check box next to the CanUserEditRows property.

In XAML

For example to disable cell editing, add CanUserEditRows="False" to the <c1:C1DataGrid> tag so that it appears similar to the following:

<c1:C1DataGrid Name="c1datagrid1" Height="180" Width="250" CanUserEditRows="False" />

In Code

For example, to disable cell editing, add the following code to your project:

 

Visual Basic
Copy Code
Me.C1DataGrid1.CanUserEditRows = False

 

C#
Copy Code
this.c1DataGrid1.CanUserEditRows = false;

 

What You've Accomplished

Run the application and double-click a cell; observe that the cell does not move into edit mode and you can no longer edit grid content at run time. For more information about cell editing, see the Editing Cells topic.