DataGrid for WPF and Silverlight Overview > DataGrid Features > Editing > Locking the Grid |
By default users can interact and edit the grid and columns in the grid. If you choose, you can set the grid or specific columns in the grid to not be editable with the IsReadOnly property.
In XAML
To lock the grid from being edited, add IsReadOnly="True" to the <c1:C1DataGrid> tag so that it appears similar to the following:
<c1:C1DataGrid x:Name="C1DataGrid1" IsReadOnly="True">
In Code
To lock the grid from editing, set the IsReadOnly property to True. For example:
Visual Basic |
Copy Code
|
---|---|
Me.C1DataGrid1.IsReadOnly = True |
C# |
Copy Code
|
---|---|
this.c1DataGrid1.IsReadOnly = true; |