DataGrid for WPF and Silverlight Overview > DataGrid Features > Column and Row Resizing |
By default end users can resize columns and rows in the grid at run time. For more information, see Resizing Columns and Rows. If you choose, however, you can disable the column and row resizing feature by setting the C1DataGrid.CanUserResizeColumns and C1DataGrid.CanUserResizeRows properties to False.
At Design Time
To disable column and row resizing, complete the following steps:
In XAML
For example to disable column and row resizing, add CanUserResizeColumns="False" CanUserResizeRows="False" to the <c1:C1DataGrid> tag so that it appears similar to the following:
<c1:C1DataGrid Name="c1datagrid1" Height="180" Width="250" CanUserResizeColumns="False" CanUserResizeRows="False"/>
In Code
For example, to disable column and row resizing, add the following code to your project:
Visual Basic |
Copy Code
|
---|---|
Me.C1DataGrid1.CanUserResizeColumns = False Me.C1DataGrid1.CanUserResizeRows = False |
C# |
Copy Code
|
---|---|
this.c1DataGrid1.CanUserResizeColumns = false; this.c1DataGrid1.CanUserResizeRows = false; |
What You've Accomplished
Run the application and observe that you can no longer resize columns or rows at run time by preforming a drag-and-drop operation. For more information about column reordering, see the Resizing Columns and Rows topic.