[.NET Framework] C1FlexGrid Row Column set AllowResizing performance

Posted by: daniel.schoenbach on 1 April 2026, 2:29 pm EST

    • Post Options:
    • Link

    Posted 1 April 2026, 2:29 pm EST

    Hi,

    I’m using the WPF C1FlexGrid on v4.6.20232.790. In this particular grid, we want to allow resizing on the first row and first column but want to disallow resizing on the other rows and columns. Since Row.AllowResizing and Column.AllowResizing default to true, we do this by simply looping through all rows and columns (skipping the first of each) and set AllowResizing to false.

    However, the method where we do this came up during performance profiling of some large grids (approx. 5k rows and 5k columns). It seems like setting AllowResizing triggers some property change notifications or other collection change notifications that make this inefficient when performed on a large number of rows or columns.

    I could set AllowResizing to false on the FlexGrid itself, but that would disallow resizing on the first row and column. I also didn’t see a way to make AllowResizing false by default (so that I could just set it true on the first row and column). I did consider using an event handler on FlexGrid.AutoGeneratingColumns to set AllowResizing, but there’s no equivalent handler for the rows.

    Thanks for any suggestions or workarounds you can provide.

  • Posted 2 April 2026, 6:48 am EST

    Hi,

    Thank you for sharing all the details.

    Based on your scenario, we can suggest two possible workarounds for the performance behavior you are observing:

    (1) Using the RowColCollection.DeferNotifications() method

    You can use this method on the Rows/Columns collection to suspend notifications, and in the meantime, set the AllowResizing property to false. Please refer to the code snippet below:

    using (flexGrid.Rows.DeferNotifications())
    {
        for (int r = 1; r < flexGrid.Rows.Count; r++)
        {
            flexGrid.Rows[r].AllowResizing = false;
        }
    }

    You can use the same method on the flexGrid.Columns collection as well to disable column resizing.

    (2) Using the ResizingRow/ResizingColumn event

    If the first workaround does not improve performance, the only remaining option is to handle the ResizingRow and ResizingColumn events of the C1FlexGrid and set the e.Cancel property to true for the rows or columns for which you want to disable resizing.

    Please refer to the code snippet below:

    flexGrid.ResizingRow += FlexGrid_ResizingRowColumn;
    flexGrid.ResizingColumn += FlexGrid_ResizingRowColumn;
    
    private void FlexGrid_ResizingRowColumn(object sender, C1.WPF.FlexGrid.CellRangeEventArgs e)
    {
        e.Cancel = (e.Row != 0 && e.Column != 0);
    }

    Best Regards,

    Kartik

  • Posted 13 April 2026, 10:09 am EST

    RowColCollection.DeferNotifications()
    was exactly what I was looking for and worked like a charm.

    Thanks so much!

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels