Version

SetEnabled(UltraExplorerBarEventIds,Boolean) Method

Enables/Disables a specific event.
Syntax
'Declaration
 
Public Overloads Sub SetEnabled( _
   ByVal eventid As UltraExplorerBarEventIds, _
   ByVal enabled As Boolean _
) 
public void SetEnabled( 
   UltraExplorerBarEventIds eventid,
   bool enabled
)

Parameters

eventid
Enumerator specifying the event to enabled/disable.
enabled
Boolean specifying whether the event is 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 code demonstrates how to use the Event Manager to manage event firing.

Imports System.Diagnostics
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinExplorerBar


	Private Sub button94_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button94.Click

		' Get UltraExplorerBar'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.
		Dim eventManager As UltraExplorerBarEventManager = Me.ultraExplorerBar1.EventManager


		' Disable the ActiveGroupChanged/ActiveGroupChanging events
		eventManager.SetEnabled(UltraExplorerBarEventIds.ActiveGroupChanged, False)
		eventManager.SetEnabled(UltraExplorerBarEventIds.ActiveGroupChanging, False)


		' The event manager exposes an 'IsEnabled' method to see if an event
		' is enabled or disbled.  Display the enabled status of the
		' ActiveGroupChanged/ActiveGroupChanging events to verify that they are disabled.
		Debug.WriteLine(String.Format("IsEnabled returns '{0}' for the ActiveGroupChanged event", eventManager.IsEnabled(UltraExplorerBarEventIds.ActiveGroupChanged).ToString()))
		Debug.WriteLine(String.Format("IsEnabled returns '{0}' for the ActiveGroupChanging event", eventManager.IsEnabled(UltraExplorerBarEventIds.ActiveGroupChanging).ToString()))


		' Re-enable the ActiveGroupChanged/ActiveGroupChanging events
		eventManager.SetEnabled(UltraExplorerBarEventIds.ActiveGroupChanging, True)
		eventManager.SetEnabled(UltraExplorerBarEventIds.ActiveGroupChanged, True)


		' Display the enabled status of the ActiveGroupChanged/ActiveGroupChanging events
		' to verif that they have been re-enabled.
		Debug.WriteLine(String.Format("IsEnabled returns '{0}' for the ActiveGroupChanged event", eventManager.IsEnabled(UltraExplorerBarEventIds.ActiveGroupChanged).ToString()))
		Debug.WriteLine(String.Format("IsEnabled returns '{0}' for the ActiveGroupChanging event", eventManager.IsEnabled(UltraExplorerBarEventIds.ActiveGroupChanging).ToString()))


		' 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 = False) Then
			eventManager.AllEventsEnabled = True
		End If


		' The 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.
		eventManager.SetEnabled(UltraExplorerBarEventGroups.AfterEvents, False)

		Debug.WriteLine(String.Format("IsEnabled returns '{0}' for the 'before' events", eventManager.IsEnabled(UltraExplorerBarEventGroups.BeforeEvents).ToString()))
		Debug.WriteLine(String.Format("IsEnabled returns '{0}' for the 'after' events", eventManager.IsEnabled(UltraExplorerBarEventGroups.AfterEvents).ToString()))

		eventManager.SetEnabled(UltraExplorerBarEventGroups.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(UltraExplorerBarEventIds.GroupAdding)) Then
			' ... 
		End If
	End Sub
using System.Diagnostics;
using Infragistics.Win;
using Infragistics.Win.UltraWinExplorerBar;


		private void button94_Click(object sender, System.EventArgs e)
		{
			// Get UltraExplorerBar'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.
			UltraExplorerBarEventManager eventManager = this.ultraExplorerBar1.EventManager;


			// Disable the ActiveGroupChanged/ActiveGroupChanging events
			eventManager.SetEnabled(UltraExplorerBarEventIds.ActiveGroupChanged, false );
			eventManager.SetEnabled(UltraExplorerBarEventIds.ActiveGroupChanging, false );


			// The event manager exposes an 'IsEnabled' method to see if an event
			// is enabled or disbled.  Display the enabled status of the
			// ActiveGroupChanged/ActiveGroupChanging events to verify that they are disabled.
			Debug.WriteLine(string.Format("IsEnabled returns '{0}' for the ActiveGroupChanged event", eventManager.IsEnabled(UltraExplorerBarEventIds.ActiveGroupChanged).ToString()));
			Debug.WriteLine(string.Format("IsEnabled returns '{0}' for the ActiveGroupChanging event", eventManager.IsEnabled(UltraExplorerBarEventIds.ActiveGroupChanging).ToString()));


			// Re-enable the ActiveGroupChanged/ActiveGroupChanging events
			eventManager.SetEnabled(UltraExplorerBarEventIds.ActiveGroupChanging, true );
			eventManager.SetEnabled(UltraExplorerBarEventIds.ActiveGroupChanged, true );


			// Display the enabled status of the ActiveGroupChanged/ActiveGroupChanging events
			// to verif that they have been re-enabled.
			Debug.WriteLine(string.Format("IsEnabled returns '{0}' for the ActiveGroupChanged event", eventManager.IsEnabled(UltraExplorerBarEventIds.ActiveGroupChanged).ToString()));
			Debug.WriteLine(string.Format("IsEnabled returns '{0}' for the ActiveGroupChanging event", eventManager.IsEnabled(UltraExplorerBarEventIds.ActiveGroupChanging).ToString()));


			// 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 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.
			eventManager.SetEnabled(UltraExplorerBarEventGroups.AfterEvents, false);

			Debug.WriteLine(string.Format("IsEnabled returns '{0}' for the 'before' events", eventManager.IsEnabled(UltraExplorerBarEventGroups.BeforeEvents).ToString()));
			Debug.WriteLine(string.Format("IsEnabled returns '{0}' for the 'after' events", eventManager.IsEnabled(UltraExplorerBarEventGroups.AfterEvents).ToString()));

			eventManager.SetEnabled(UltraExplorerBarEventGroups.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(UltraExplorerBarEventIds.GroupAdding))
			{
				// ... 
			}
		}
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