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

Occurs before an UltraTreeNodeColumn is moved via a drag and drop operation by the end user.

Syntax

Visual Basic (Declaration) 
Public Event BeforeColumnMoved() As BeforeColumnMovedEventHandler
C# 
public event BeforeColumnMovedEventHandler BeforeColumnMoved()

Example

The following code sample demonstrates how to use the BeforeColumnMoved and AfterColumnMoved 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_AfterColumnMoved(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinTree.AfterColumnMovedEventArgs) Handles ultraTree1.AfterColumnMoved
        Debug.WriteLine("Column '" + e.Column.TextResolved + "' successfully moved")
    End Sub

    Private Sub ultraTree1_BeforeColumnMoved(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinTree.BeforeColumnMovedEventArgs) Handles ultraTree1.BeforeColumnMoved
        ' Disallow moving the leftmost column
        If e.Column.LayoutInfo.OriginX = 0 Then
            e.Cancel = True
        End If
    End Sub
C#Copy Code
using Infragistics.Win;
using Infragistics.Win.Layout;
using Infragistics.Win.UltraWinTree;
using System.Diagnostics;

       
private void ultraTree1_AfterColumnMoved(object sender, Infragistics.Win.UltraWinTree.AfterColumnMovedEventArgs e)
       {
           Debug.WriteLine(
"Column '" + e.Column.TextResolved + "' successfully moved" );
       }

       
private void ultraTree1_BeforeColumnMoved(object sender, Infragistics.Win.UltraWinTree.BeforeColumnMovedEventArgs e)
       {
           
//    Disallow moving the leftmost column
           
if ( e.Column.LayoutInfo.OriginX == 0 )
               e.Cancel = true;
       }

See Also