Version

SuspendBindingNotifications Method

Suspends firing of IBindingList related notifications. This is useful if you want to make lot of modifications and temporarily prevent the controls bound to this data source from handling events associated with the data source modification.
Syntax
'Declaration
 
Public Sub SuspendBindingNotifications() 
public void SuspendBindingNotifications()
Remarks

This method along with the SuspendBindingNotifications can be used to temporarily prevent UltraDataSource from firing ListChanged ItemChanged notifications. This can be useful in a situation where a lot of cells need to be modified however for efficiency reasons you do not want to fire ListChanged ItemChanged notification for every cell that's modified. In such a situation you would call SuspendBindingNotifications and modify cells and then call ResumeBindingNotifications. When ResumeBindingNotifications is called the UltraDataSource fires a single ListChanged Reset notification for every row collection that was affected to cause the bound controls to reload the data. To prevent the ResumeBindingNotifications from firing any notifications on resumption, use the overload of ResumeBindingNotifications that takes in fireNotifications parameter. However note that if you specify false for fireNotifications parameter then the bound controls may not reflect the changed cell values. You will have to invalidate those controls manually yourself.

Note: If the data source is bound to an UltraGrid, as expected, the UltraGrid will not fire InitializeRow event for the rows you modify since it will not receive any ItemChanged notifications.

,
Example
Following code shows how to suspend IBindingList.ListChanged notifications temporarily on an UltraDataSource.

Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinDataSource
Imports Infragistics.Win.UltraWinGrid


    Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button1.Click
        ' SuspendBindingNotifications and ResumeBindingNotifications are used when
        ' performing a large number of updates to the data. What it does is that it
        ' prevents the UltraDataSource from firing ListChanged notifications on the
        ' IBindingList implementation so any bound controls do not process the 
        ' individual changes. When ResumeBindingNotifications is called, 
        ' UltraDataSource will fire ListChanged with Reset as the type specifying
        ' to the bound controls that they should reget the data for all rows. This
        ' can be more efficient than firing notifications for individual changes
        ' when there are lot of changes being made.
        '
        Try
            ' Suspend IBindingList ListChanged notifications.
            Me.UltraDataSource1.SuspendBindingNotifications()

            ' Value of BindingNotificationsSuspended property should be true after
            ' calling SuspendBindingNotifications method.
            Debug.WriteLine("Binding Notifications Suspended: " & Me.UltraDataSource1.BindingNotificationsSuspended)

            Dim row As UltraDataRow
            Dim column As UltraDataColumn
            For Each row In Me.UltraDataSource1.Rows
                For Each column In row.Band.Columns
                    row(column) = DBNull.Value
                Next
            Next
        Finally
            ' Resume ListChanged notifications.
            Me.UltraDataSource1.ResumeBindingNotifications()
        End Try
    End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinDataSource;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;
		private void button1_Click(object sender, System.EventArgs e)
		{
			// SuspendBindingNotifications and ResumeBindingNotifications are used when
			// performing a large number of updates to the data. What it does is that it
			// prevents the UltraDataSource from firing ListChanged notifications on the
			// IBindingList implementation so any bound controls do not process the 
			// individual changes. When ResumeBindingNotifications is called, 
			// UltraDataSource will fire ListChanged with Reset as the type specifying
			// to the bound controls that they should reget the data for all rows. This
			// can be more efficient than firing notifications for individual changes
			// when there are lot of changes being made.
			//
			try
			{
				// Suspend IBindingList ListChanged notifications.
				this.ultraDataSource1.SuspendBindingNotifications( );

				// Value of BindingNotificationsSuspended property should be true after
				// calling SuspendBindingNotifications method.
				Debug.WriteLine( "Binding Notifications Suspended: " + this.ultraDataSource1.BindingNotificationsSuspended );

				foreach ( UltraDataRow row in this.ultraDataSource1.Rows )
				{
					foreach ( UltraDataColumn column in row.Band.Columns )
					{
						row[ column ] = DBNull.Value;
					}
				}
			}
			finally
			{
				// Resume ListChanged notifications.
				this.ultraDataSource1.ResumeBindingNotifications( );				
			}
		}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also