Version

SummaryValueChanged Event

This event is fired when a summary value for a summary changes. It is also fired when the summary is calculated for the first time. The user can initialize appearance and other settings off the SummaryValue object that gets passed in the event handler.
Syntax
'Declaration
 
Public Event SummaryValueChanged As SummaryValueChangedEventHandler
public event SummaryValueChangedEventHandler SummaryValueChanged
Event Data

The event handler receives an argument of type SummaryValueChangedEventArgs containing data related to this event. The following SummaryValueChangedEventArgs properties provide information specific to this event.

PropertyDescription
SummaryValue Object with information on summary value.
Remarks

You can use the SummaryValueChanged event to apply any appearance settings to passed in SummaryValue object.

Example
Following code shows some of the information available in SummaryValueChanged event. It sets different appearance on different summaries based on summary values.

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

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

  Private Sub UltraGrid1_SummaryValueChanged(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.SummaryValueChangedEventArgs) Handles ultraGrid1.SummaryValueChanged

      ' Use the key to identify what summary the SummaryValue object is associated with
      ' and set appearance properties accordingly.

      If e.SummaryValue.Key = "Max" Then
          If CType(e.SummaryValue.Value, Decimal) < 20 Then
              ' If the max is less than han 40, then highlight the summary with red color
              ' by setting the back color to red
              e.SummaryValue.Appearance.BackColor = Color.LightYellow
          Else
              e.SummaryValue.Appearance.BackColor = Color.SkyBlue
          End If
      End If

      If e.SummaryValue.Key = "Avg" Then
          If CType(e.SummaryValue.Value, Decimal) > 20 Then
              ' If the sum is greater than 20, then highlight the summary with red color
              ' by setting the back color to red
              e.SummaryValue.Appearance.BackColor = Color.LightSkyBlue
          Else
              e.SummaryValue.Appearance.BackColor = Color.LightYellow
          End If
      End If

  End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

private void ultraGrid1_SummaryValueChanged(object sender, Infragistics.Win.UltraWinGrid.SummaryValueChangedEventArgs e)
{

	// Use the key to identify what summary the SummaryValue object is associated with
	// and set appearance properties accordingly.

	if ( e.SummaryValue.Key == "Max" )
	{	
		if ( (decimal)e.SummaryValue.Value < 20 )
		{
			// If the max is less than han 40, then highlight the summary with red color
			// by setting the back color to red
			e.SummaryValue.Appearance.BackColor = Color.LightYellow;
		}
		else 
		{
			e.SummaryValue.Appearance.BackColor = Color.SkyBlue;
		}
	}

	if ( e.SummaryValue.Key == "Avg" )
	{	
		if ( (decimal)e.SummaryValue.Value > 20 )
		{
			// If the sum is greater than 20, then highlight the summary with red color
			// by setting the back color to red
			e.SummaryValue.Appearance.BackColor = Color.LightSkyBlue;
		}
		else 
		{
			e.SummaryValue.Appearance.BackColor = Color.LightYellow;
		}
	}

}
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