Infragistics2.Win.UltraWinTree.v8.1
BeforeNodeLayoutItemSpanResize Event
See Also  Example
Infragistics.Win.UltraWinTree Namespace > UltraTree Class : BeforeNodeLayoutItemSpanResize Event

Occurs before a node layout item (i.e., a column header or cell) is span resized by the end user.

Syntax

Visual Basic (Declaration) 
Public Event BeforeNodeLayoutItemSpanResize() As BeforeNodeLayoutItemSpanResizeEventHandler
C# 
public event BeforeNodeLayoutItemSpanResizeEventHandler BeforeNodeLayoutItemSpanResize()

Example

The following code sample demonstrates how to use the BeforeNodeLayoutItemSpanResize and AfterNodeLayoutItemSpanResize 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.

Visual BasicCopy Code
Imports Infragistics.Win
Imports Infragistics.Win.Layout
Imports Infragistics.Win.UltraWinTree

    Private Sub ultraTree1_AfterNodeLayoutItemSpanResize(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinTree.AfterNodeLayoutItemSpanResizeEventArgs) Handles ultraTree1.AfterNodeLayoutItemSpanResize
        ' Output a message to the debug window describing the resize operation
        Dim message As String = String.Empty
        If (e.IsCell) Then
            Message = "Cell '" + e.Cell.Text + "' was successfully span resized."
        Else
            Message = "The header of column '" + e.Column.TextResolved + "' was successfully span resized."
        End If

        Debug.WriteLine(Message)
    End Sub

    Private Sub ultraTree1_BeforeNodeLayoutItemSpanResize(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinTree.BeforeNodeLayoutItemSpanResizeEventArgs) Handles ultraTree1.BeforeNodeLayoutItemSpanResize
        ' Disallow cell span resizing for non-root level nodes
        If Not e.Node Is Nothing AndAlso e.Node.Level > 0 Then
            e.Cancel = True
            Return
        End If

        ' Output a message to the debug window describing the resize operation
        Dim message As String = String.Empty
        If (e.IsCell) Then
            message = "Cell '" + e.Cell.Text + "' is being resized."
        ElseIf (e.IsLabel) Then
            message = "The header of column '" + e.Column.TextResolved + "' is being resized."
        End If

        Debug.WriteLine(message)
    End Sub
C#Copy Code
using Infragistics.Win;
using Infragistics.Win.Layout;
using Infragistics.Win.UltraWinTree;
using System.Diagnostics;

       
private void ultraTree1_AfterNodeLayoutItemSpanResize(object sender, Infragistics.Win.UltraWinTree.AfterNodeLayoutItemSpanResizeEventArgs e)
       {            
           
//    Output a message to the debug window describing the resize operation
           
string message = string.Empty;
           
if ( e.IsCell )
               message =
"Cell '" + e.Cell.Text + "' was successfully span resized.";
           
else
               
message = "The header of column '" + e.Column.TextResolved + "' was successfully span resized.";

           Debug.WriteLine( message );
       }

       
private void ultraTree1_BeforeNodeLayoutItemSpanResize(object sender, Infragistics.Win.UltraWinTree.BeforeNodeLayoutItemSpanResizeEventArgs e)
       {
           
//    Disallow cell span resizing for non-root level nodes
           
if ( e.Node != null && e.Node.Level > 0 )
           {
               e.Cancel = true;
               
return;
           }

           Size originalSize = Size.Empty;

           
//    Output a message to the debug window describing the resize operation
           
string message = string.Empty;
           
if ( e.IsCell )
               message =
"Cell '" + e.Cell.Text + "' is being resized.";
           
else
           
if ( e.IsLabel )
               message =
"The header of column '" + e.Column.TextResolved + "' is being resized.";

           Debug.WriteLine( message );
       }

See Also