Version

BeforeRowRegionSplit Event

Occurs before a row scrolling region is split into two row scrolling regions.
Syntax
'Declaration
 
Public Event BeforeRowRegionSplit As BeforeRowRegionSplitEventHandler
public event BeforeRowRegionSplitEventHandler BeforeRowRegionSplit
Event Data

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

PropertyDescription
Cancel (Inherited from System.ComponentModel.CancelEventArgs) 
NewRowScrollRegion The new row scroll region (read-only)
OriginalRowScrollRegion The original row scroll region (read-only)
Remarks

The originalrowscrollregion argument returns a reference to a RowScrollRegion object that can be used to set properties of, and invoke methods on, the rowscrollregion as it exists before the split. You can use this reference to access any of the returned rowscrollregion's properties or methods. However, the Height property of this rowscrollregion is read-only in this event procedure.

The newrowscrollregion argument returns a reference to a RowScrollRegion object that can be used to set properties of, and invoke methods on, the rowscrollregion as it will exist after the split. You can use this reference to access any of the returned rowscrollregion's properties or methods. However, the Height property of this rowscrollregion is read-only in this event procedure.

The cancel argument enables you to programmatically prevent the rowscrollregion from being split. This argument can be used to prevent the user from splitting the rowscrollregion unless a certain condition is met.

This event is generated before a rowscrollregion is split, either programmatically, or by user interaction. A rowscrollregion can be split programmatically by invoking its Split method.

The BeforeRowRegionRemoved event is generated before a rowscrollregion is removed.

The BeforeRowRegionSize event is generated before a rowscrollregion is sized.

The BeforeColRegionSplit event is generated before a colscrollregion is split.

Example
Following code illustrates how you can use combination of BeforeRowRegionSplit and BeforeRowRegionSize events to prevent the user from resizing any of the row scroll regions too small. BeforeRowRegionSize event gets fired when the user resizes any of the existing row scroll regions and BeforeRowRegionSplit gets fired when the user splits a row scroll region.

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_BeforeRowRegionSplit(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.BeforeRowRegionSplitEventArgs) Handles ultraGrid1.BeforeRowRegionSplit

      ' If the new scroll region is smaller than 50 pixels, then cancel the event
      ' so the UltraGrid doesn't proceed with the region split.
      If e.NewRowScrollRegion.Height < 50 Then
          e.Cancel = True

          ' Also cancel if the row scroll region being split would end up being less
          ' than 50 pixels as a result of the split.
      ElseIf e.OriginalRowScrollRegion.Height - e.NewRowScrollRegion.Height < 50 Then
          e.Cancel = True
      End If

      If e.Cancel Then
          MessageBox.Show("You cannot split a row scroll region smaller than 50 pixels.")
      End If

  End Sub

  Private Sub UltraGrid1_BeforeRowRegionSize(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.BeforeRowRegionSizeEventArgs) Handles ultraGrid1.BeforeRowRegionSize

      ' If the user resizes a scroll region in such a way so that any of the
      ' effected scroll regions ends up being less than 50, then cancel it.			
      If e.Region1.Height < 50 Or e.Region2.Height < 50 Then
          e.Cancel = True
          MessageBox.Show("You cannot resize a row scroll region smaller than 50 pixels.")
      End If

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

private void ultraGrid1_BeforeRowRegionSplit(object sender, Infragistics.Win.UltraWinGrid.BeforeRowRegionSplitEventArgs e)
{

	// If the new scroll region is smaller than 50 pixels, then cancel the event
	// so the UltraGrid doesn't proceed with the region split.
	if ( e.NewRowScrollRegion.Height < 50 )
		e.Cancel = true;

	// Also cancel if the row scroll region being split would end up being less
	// than 50 pixels as a result of the split.
	else if ( e.OriginalRowScrollRegion.Height - e.NewRowScrollRegion.Height < 50 )
		e.Cancel = true;

	if ( e.Cancel )
	{
		MessageBox.Show( "You cannot split a row scroll region smaller than 50 pixels." );
	}

}

private void ultraGrid1_BeforeRowRegionSize(object sender, Infragistics.Win.UltraWinGrid.BeforeRowRegionSizeEventArgs e)
{

	// If the user resizes a scroll region in such a way so that any of the
	// effected scroll regions ends up being less than 50, then cancel it.			
	if ( e.Region1.Height < 50 || e.Region2.Height < 50 )
	{
		e.Cancel = true;

		MessageBox.Show( "You cannot resize a row scroll region smaller than 50 pixels." );
	}

}
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