[]
        
(Showing Draft Content)

C1.WPF.FlexGrid.RowColCollection-1.DeferNotifications

DeferNotifications Method

DeferNotifications()

Suspends notifications until the returned IDisposable object is disposed.

Declaration
public IDisposable DeferNotifications()
Returns
Type Description
IDisposable

An IDisposable object that must be disposed to restore notifications.

Remarks

This method is typically used in update blocks to perform batch updates efficiently and safely.

Examples
<p>The example below shows how you can use the <b>DeferNotifications</b> method to suspend

notifications while setting the width of several columns on the grid.

Note that the call to the DeferNotifications method is placed in a using statement, which automatically disposes of the object and restores notifications at the end of the block, even if the code within the block throws an exception. This makes the code more readable and concise than calling the more traditional BeginUpdate and EndUpdate methods within a try/finally block.

<pre><code class="lang-csharp">var grid = new C1FlexGrid();
using (grid.Columns.DeferNotifications())
{
  foreach (var col in grid.Columns)
  {
    col.Width = 100;
  }
}</code></pre>