ComponentOne DataGrid for WPF and Silverlight
DataGrid for WPF and Silverlight Overview / DataGrid Features / Add New Row / Disable Adding New Rows
In This Topic
    Disable Adding New Rows
    In This Topic

    By default end users add new rows and content to the grid at run time. A new row bar appears at the bottom of the grid, users can enter text in the bar to add new content to the grid. For more information, see Adding Rows to the Grid. If you choose, however, you can disable the new row bar feature by setting the CanUserAddRows property to False.

    At Design Time

    To disable adding rows, complete the following steps:

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

    In XAML

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

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

     

    In Code

    For example, to disable adding rows, add the following code to your project:

    Visual Basic
    Copy Code
    Me.C1DataGrid1.CanUserAddRows = False
    C#
    Copy Code
    this.c1DataGrid1.CanUserAddRows = false;

     

    What You've Accomplished

    Run the application and scroll to the end of the grid, if needed. Observe that the new row bar no longer appears in the grid and that users can no longer add new rows and content to the grid. For more information about cell editing, see the Adding Rows to the Grid topic.