Version

BeforeRowResize Event

Occurs before a row has been resized.
Syntax
'Declaration
 
Public Event BeforeRowResize As BeforeRowResizeEventHandler
public event BeforeRowResizeEventHandler BeforeRowResize
Event Data

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

PropertyDescription
Cancel (Inherited from System.ComponentModel.CancelEventArgs) 
NewHeight The new height (read-only)
Row The row (read-only)
Remarks

The row argument returns a reference to an UltraGridRow object that can be used to set properties of, and invoke methods on, the row that will be resized. You can use this reference to access any of the returned row's properties or methods.

The rowheight argument indicates the new height of the row. The current height is indicated by the Height property of the UltraGridRow object returned by row.

The cancel argument enables you to programmatically prevent the row from being resized. This argument can be used to prevent the row from resizing unless a certain condition is met.

Depending on the value of the RowSizing property, more than one row can be affected by the resize. In this case, row refers to the original row being resized.

The AfterRowResize event, which occurs after a row has been resized, is generated after this event, provided cancel is not set to True.

Example
Following code shows how you can use BeforeRowResize event to prevent the user from resizing a row to heights greater than 50 pixels.

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_BeforeRowResize(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.BeforeRowResizeEventArgs) Handles ultraGrid1.BeforeRowResize

      If e.NewHeight > 50 Then
          ' Cancel the event so the UltraGrid doesn't proceed with resizing.
          e.Cancel = True

          ' Set the height to the max height, 50.
          e.Row.Height = 50
      End If

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

private void ultraGrid1_BeforeRowResize(object sender, Infragistics.Win.UltraWinGrid.BeforeRowResizeEventArgs e)
{

	if ( e.NewHeight > 50 )
	{
		// Cancel the event so the UltraGrid doesn't proceed with resizing.
		e.Cancel = true;

		// Set the height to the max height, 50.
		e.Row.Height = 50;
	}

}
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