Version

SetEnabled(EventGroups,Boolean) Method

Enables/Disables all events in the group.
Syntax
'Declaration
 
Public Overloads Sub SetEnabled( _
   ByVal group As EventGroups, _
   ByVal enabled As Boolean _
) 
public void SetEnabled( 
   EventGroups group,
   bool enabled
)

Parameters

group
Enumerator specifying the group of events to enabled/disabled.
enabled
Boolean specifying whether the events are enabled (true) or disabled (false).
Remarks

Disabling an event will not affect the internal operation of the control. Disabling simply instructs the control not to call the event handler so that code the programmer entered is not fired.

For example, disabling the CLick will not stop the control from changing the Active Node when it is clicked. It will only cause the Click Event not to fire when the control is clicked.

Example
The following sample code illustrates how the event manager can be used to temporarily enable/disable events.

Imports Infragistics.Win.UltraWinTree

Private Sub button20_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button20.Click

    If Me.ultraTree1.ActiveNode Is Nothing Then Return

    Dim eventManager As TreeEventManager

    ' Get the tree's event manager.
    ' The event manager is used to temporarily disable events
    ' to prevent them from being raised. This can be very
    ' convenient in a situation where one or more properties
    ' are being set in code and the events they would normally 
    ' raise would cause unnecessary or counter-productive
    ' code to be executed.
    '
    ' Note: All events are enabled by default.
    eventManager = Me.ultraTree1.EventManager

    ' Disable the Before/AfterSelect events
    eventManager.SetEnabled(TreeEventIds.BeforeSelect, False)
    eventManager.SetEnabled(TreeEventIds.AfterSelect, False)

    ' Toggle the selection state of the active node.
    ' Note: This would normally cause the Before/AfterSelect 
    ' events to be raised. However, since the above code 
    ' disabled the events they won't be.
    Me.ultraTree1.ActiveNode.Selected = Not Me.ultraTree1.ActiveNode.Selected()

    ' Re-enable the Before/AfterSelect events
    eventManager.SetEnabled(TreeEventIds.BeforeSelect, True)
    eventManager.SetEnabled(TreeEventIds.AfterSelect, True)

    ' The 'AllEventsEnabled' property lets you enable/disable
    ' all events will a single line of code. If any event is 
    ' disabled the 'AllEventsEnabled' property returns false.
    If Not eventManager.AllEventsEnabled Then
        eventManager.AllEventsEnabled = True
    End If

    ' The event manager also exposes an 'IsEnabled' method
    ' to see if an event is enabled or disbled.
    If Not eventManager.IsEnabled(TreeEventIds.BeforeSelect) Then
        eventManager.SetEnabled(TreeEventIds.BeforeSelect, True)
    End If

    ' The tree event manager also exposes overloaded 
    ' 'IsEnabled' and 'SetEnabled' methods that take an  
    ' event group so that, for example all 'Before' or all
    ' 'After' events can be enabled/disabled. If any event
    ' in the group is disabled the 'IsEnabled' method returns
    ' false.
    If Not eventManager.IsEnabled(EventGroups.BeforeEvents) Then
        eventManager.SetEnabled(EventGroups.BeforeEvents, True)
    End If

    ' The 'InProgress' method will return true if the 
    ' specified event is currently being raised. This
    ' is often helpful in methods that can be called
    ' from various points in an application to determine
    ' what is triggering the call.
    If eventManager.InProgress(TreeEventIds.BeforeSelect) Then
        ' ... 
    End If

    eventManager.SetEnabled(EventGroups.AfterEvents, True)

End Sub
using Infragistics.Win.UltraWinTree;

private void button20_Click(object sender, System.EventArgs e)
{

	if ( this.ultraTree1.ActiveNode == null )
		return;

	// Get the tree's event manager.
	// The event manager is used to temporarily disable events
	// to prevent them from being raised. This can be very
	// convenient in a situation where one or more properties
	// are being set in code and the events they would normally 
	// raise would cause unnecessary or counter-productive
	// code to be executed.
	//
	// Note: All events are enabled by default.
	TreeEventManager eventManager = this.ultraTree1.EventManager;

	// Disable the Before/AfterSelect events
	eventManager.SetEnabled( TreeEventIds.BeforeSelect, false );
	eventManager.SetEnabled( TreeEventIds.AfterSelect, false );

	// Toggle the selection state of the active node.
	// Note: This would normally cause the Before/AfterSelect 
	// events to be raised. However, since the above code 
	// disabled the events they won't be.
	this.ultraTree1.ActiveNode.Selected = 
		!this.ultraTree1.ActiveNode.Selected;

	// Re-enable the Before/AfterSelect events
	eventManager.SetEnabled( TreeEventIds.BeforeSelect, true );
	eventManager.SetEnabled( TreeEventIds.AfterSelect, true );

	// The 'AllEventsEnabled' property lets you enable/disable
	// all events will a single line of code. If any event is 
	// disabled the 'AllEventsEnabled' property returns false.
	if ( !eventManager.AllEventsEnabled )
		eventManager.AllEventsEnabled = true;

	// The event manager also exposes an 'IsEnabled' method
	// to see if an event is enabled or disbled.
	if ( !eventManager.IsEnabled(TreeEventIds.BeforeSelect ) )
		eventManager.SetEnabled(TreeEventIds.BeforeSelect, true );

	// The tree event manager also exposes overloaded 
	// 'IsEnabled' and 'SetEnabled' methods that take an  
	// event group so that, for example all 'Before' or all
	// 'After' events can be enabled/disabled. If any event
	// in the group is disabled the 'IsEnabled' method returns
	// false.
	if ( !eventManager.IsEnabled(EventGroups.BeforeEvents ) )
		eventManager.SetEnabled(EventGroups.BeforeEvents, true );

	eventManager.SetEnabled(EventGroups.AfterEvents, true );

	// The 'InProgress' method will return true if the 
	// specified event is currently being raised. This
	// is often helpful in methods that can be called
	// from various points in an application to determine
	// what is triggering the call.
	if ( eventManager.InProgress( TreeEventIds.BeforeSelect ) )
	{
		// ... 
	}
		
}
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