ComponentOne DataGrid for WPF and Silverlight
DataGrid for WPF and Silverlight Overview / DataGrid Features / Column and Row Resizing
In This Topic
    Column and Row Resizing
    In This Topic

    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:

    1. Click the C1DataGrid control once to select it.
    2. Navigate to the Properties window and locate the CanUserResizeColumns property.
    3. Clear the check box next to the CanUserResizeColumns property.
    4. In the Properties window, locate the CanUserResizeRows property.
    5. Clear the check box next to the CanUserResizeRows property.

    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.