Version

RowLayoutItem Property (AfterRowLayoutItemResizedEventArgs)

Row-Layout item being resized. This can be either an UltraGridColumn or a ColumnHeader. It will be UltraGridColumn if the item being resized is a cell. It will be ColumnHeader if the item being resized is a header.
Syntax
'Declaration
 
Public ReadOnly Property RowLayoutItem As Infragistics.Win.Layout.ILayoutItem
public Infragistics.Win.Layout.ILayoutItem RowLayoutItem {get;}
Example
Following code shows some of the information available in BeforeRowLayoutItemResized and AfterRowLayoutItemResized events.

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_BeforeRowLayoutItemResized(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.BeforeRowLayoutItemResizedEventArgs) Handles UltraGrid1.BeforeRowLayoutItemResized
        Debug.Write("BeforeRowLayoutItemResized: ")

        If TypeOf e.RowLayoutItem Is UltraGridColumn Then
            ' If the RowLayoutItem is an instance of UltraGridColumn, then cells associated
            ' with that column are being resized.
            Dim column As UltraGridColumn = DirectCast(e.RowLayoutItem, UltraGridColumn)

            Debug.Write("Cell in row-layout resized. Column = " & column.Header.Caption)
        Else
            ' If the RowLayoutItem is an instance of HeaderBase, then column header (also 
            ' referred to as column label) is being resized.
            Dim header As HeaderBase = DirectCast(e.RowLayoutItem, HeaderBase)

            Debug.Write("Header in row-layout resized. Header = " & header.Caption)
        End If

        Debug.WriteLine(" Old Size = " & e.OldSize.ToString() & " New Size = " & e.NewSize.ToString())

        ' You can conditionally cancel the resize operation by setting Cancel to true.
        If e.OldSize.Height <> e.NewSize.Height Then
            e.Cancel = True
        ElseIf (e.NewSize.Width > 200) Then
            ' You can also set the NewSize to impose constraints on how the item can be resized.
            ' In this case we will prevent the user from resizing items greater than 200.
            e.NewSize = New Size(200, e.NewSize.Height)
        End If
    End Sub

    Private Sub UltraGrid1_AfterRowLayoutItemResized(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.AfterRowLayoutItemResizedEventArgs) Handles UltraGrid1.AfterRowLayoutItemResized
        Debug.Write("AfterRowLayoutItemResized: ")

        If TypeOf e.RowLayoutItem Is UltraGridColumn Then
            ' If the RowLayoutItem is an instance of UltraGridColumn, then cells associated
            ' with that column are being resized.
            Dim column As UltraGridColumn = DirectCast(e.RowLayoutItem, UltraGridColumn)

            Debug.Write("Cell in row-layout resized. Column = " & column.Header.Caption)
        Else
            ' If the RowLayoutItem is an instance of HeaderBase, then column header (also 
            ' referred to as column label) is being resized.
            Dim header As HeaderBase = DirectCast(e.RowLayoutItem, HeaderBase)

            Debug.Write("Header in row-layout resized. Header = " & header.Caption)
        End If

        Debug.WriteLine(" New Size = " & e.RowLayoutItem.PreferredSize.ToString())
    End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

		private void ultraGrid1_BeforeRowLayoutItemResized(object sender, Infragistics.Win.UltraWinGrid.BeforeRowLayoutItemResizedEventArgs e)
		{
			Debug.Write( "BeforeRowLayoutItemResized: " );

			if ( e.RowLayoutItem is UltraGridColumn )
			{
				// If the RowLayoutItem is an instance of UltraGridColumn, then cells associated
				// with that column are being resized.
				UltraGridColumn column = (UltraGridColumn)e.RowLayoutItem;

				Debug.Write( "Cell in row-layout resized. Column = " + column.Header.Caption );
			}
			else
			{
				// If the RowLayoutItem is an instance of HeaderBase, then column header (also 
				// referred to as column label) is being resized.
				HeaderBase header = (HeaderBase)e.RowLayoutItem;

				Debug.Write( "Header in row-layout resized. Header = " + header.Caption );
			}

			Debug.WriteLine( " Old Size = " + e.OldSize.ToString( ) + " New Size = " + e.NewSize );

			// You can conditionally cancel the resize operation by setting Cancel to true.
			if ( e.OldSize.Height != e.NewSize.Height )
			{
				e.Cancel = true;
			}
			// You can also set the NewSize to impose constraints on how the item can be resized.
			// In this case we will prevent the user from resizing items greater than 200.
			else if ( e.NewSize.Width > 200 )
			{
				e.NewSize = new Size( 200, e.NewSize.Height );
			}
		}

		private void ultraGrid1_AfterRowLayoutItemResized(object sender, Infragistics.Win.UltraWinGrid.AfterRowLayoutItemResizedEventArgs e)
		{
			Debug.Write( "AfterRowLayoutItemResized: " );

			if ( e.RowLayoutItem is UltraGridColumn )
			{
				// If the RowLayoutItem is an instance of UltraGridColumn, then cells associated
				// with that column are being resized.
				UltraGridColumn column = (UltraGridColumn)e.RowLayoutItem;

				Debug.Write( "Cell in row-layout resized. Column = " + column.Header.Caption );
			}
			else
			{
				// If the RowLayoutItem is an instance of HeaderBase, then column header (also 
				// referred to as column label) is being resized.
				HeaderBase header = (HeaderBase)e.RowLayoutItem;

				Debug.Write( "Header in row-layout resized. Header = " + header.Caption );
			}

			Debug.WriteLine( " New Size = " + e.RowLayoutItem.PreferredSize.ToString( ) );
		}
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