'Declaration Public Class UltraTabControlEventManager Inherits Infragistics.Shared.EventManagerBase
public class UltraTabControlEventManager : Infragistics.Shared.EventManagerBase
Imports Infragistics.Win Imports Infragistics.Win.UltraWinTabs Imports Infragistics.Win.UltraWinTabControl Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ' Get the tab controls'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 UltraTabControlEventManager eventManager = Me.ultraTabControl1.EventManager ' Disable the ActiveTabChanging\Changed and SelectedTabChanging\Changed events eventManager.SetEnabled(UltraTabControlEventId.ActiveTabChanging, False) eventManager.SetEnabled(UltraTabControlEventId.ActiveTabChanged, False) eventManager.SetEnabled(UltraTabControlEventId.SelectedTabChanging, False) eventManager.SetEnabled(UltraTabControlEventId.SelectedTabChanged, False) ' Call PerformAction to select the next tab. ' Note: This would normally cause the ActiveTabChanging\Changed ' and SelectedTabChanging\Changed events to be raised. ' However, since the above code disabled the events they won't be. Me.ultraTabControl1.PerformAction(UltraTabControlAction.SelectNextTab) ' Re-enable the events eventManager.SetEnabled(UltraTabControlEventId.ActiveTabChanging, True) eventManager.SetEnabled(UltraTabControlEventId.ActiveTabChanged, True) eventManager.SetEnabled(UltraTabControlEventId.SelectedTabChanging, True) eventManager.SetEnabled(UltraTabControlEventId.SelectedTabChanged, 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 = False Then eventManager.AllEventsEnabled = True End If ' The event manager also exposes an 'IsEnabled' method ' to see if an event is enabled or disbled. If eventManager.IsEnabled(UltraTabControlEventId.ActiveTabChanging) = False Then eventManager.SetEnabled(UltraTabControlEventId.ActiveTabChanging, 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. If eventManager.IsEnabled(UltraTabControlEventGroup.BeforeEvents) = False Then eventManager.SetEnabled(UltraTabControlEventGroup.BeforeEvents, True) End If eventManager.SetEnabled(UltraTabControlEventGroup.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(UltraTabControlEventId.SelectedTabChanging) = True Then ' ... End If End Sub
using System.Diagnostics; using Infragistics.Win; using Infragistics.Win.UltraWinTabs; using Infragistics.Win.UltraWinTabControl; private void button1_Click(object sender, System.EventArgs e) { // Get the tab controls'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. UltraTabControlEventManager eventManager = this.ultraTabControl1.EventManager; // Disable the ActiveTabChanging\Changed and SelectedTabChanging\Changed events eventManager.SetEnabled( UltraTabControlEventId.ActiveTabChanging, false ); eventManager.SetEnabled( UltraTabControlEventId.ActiveTabChanged, false ); eventManager.SetEnabled( UltraTabControlEventId.SelectedTabChanging, false ); eventManager.SetEnabled( UltraTabControlEventId.SelectedTabChanged, false ); // Call PerformAction to select the next tab. // Note: This would normally cause the ActiveTabChanging\Changed // and SelectedTabChanging\Changed events to be raised. // However, since the above code disabled the events they won't be. this.ultraTabControl1.PerformAction( UltraTabControlAction.SelectNextTab ); // Re-enable the events eventManager.SetEnabled( UltraTabControlEventId.ActiveTabChanging, true ); eventManager.SetEnabled( UltraTabControlEventId.ActiveTabChanged, true ); eventManager.SetEnabled( UltraTabControlEventId.SelectedTabChanging, true ); eventManager.SetEnabled( UltraTabControlEventId.SelectedTabChanged, 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(UltraTabControlEventId.ActiveTabChanging ) ) eventManager.SetEnabled(UltraTabControlEventId.ActiveTabChanging, 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. if ( !eventManager.IsEnabled(UltraTabControlEventGroup.BeforeEvents ) ) eventManager.SetEnabled(UltraTabControlEventGroup.BeforeEvents, true ); eventManager.SetEnabled(UltraTabControlEventGroup.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( UltraTabControlEventId.SelectedTabChanging ) ) { // ... } }
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