Version

GalleryToolActiveItemChange Event (UltraToolbarsManager)

Occurs when an item in a gallery drop down or preview is activated for the length of the PopupGalleryTool.ActivationActionDelay.
Syntax
'Declaration
 
Public Event GalleryToolActiveItemChange As GalleryToolItemEventHandler
public event GalleryToolItemEventHandler GalleryToolActiveItemChange
Event Data

The event handler receives an argument of type GalleryToolItemEventArgs containing data related to this event. The following GalleryToolItemEventArgs properties provide information specific to this event.

PropertyDescription
GalleryTool Gets the gallery tool associated with this event
Group Gets the group to which the item belongs. This will not apply when the ItemLocation is Preview.
Item Gets the item associated with the event
ItemLocation Gets the gallery location of the item.
Example
The sample demonstrates how to determine when the user has activated an item in a gallery for a specified amount of time.

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.

Imports Infragistics.Win.UltraWinToolbars

Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button5.Click
	' Get the gallery from the toolbars manager whose item will be customized
	Dim gallery As PopupGalleryTool = Me.UltraToolbarsManager1.Tools("PopupGalleryTool1")

	' Set the delay for activating the first item in the gallery.  The user can mouse over
	' various items, but if they leave the item before 1000ms has ellapsed, the 
	' GalleryToolActiveItemChange event will never fire.  However, if the user does hover 
	' over an item for 1000ms, the event will fire and the ActivationActionDelay will be used
	' to determine how long to wait to activate other items.
	' NOTE: When UltraToolbarsManager.Office2007UICompatibility is true, these delays will 
	' automatically be resolved to 250ms and 0ms, respectively, for gallery previews in the ribbon.
	gallery.ActivationInitialActionDelay = 1000

	' After the first item has been activated, subsequent items will be activated immediately
	gallery.ActivationActionDelay = 0
End Sub

Private Sub UltraToolbarsManager1_GalleryToolActiveItemChange(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinToolbars.GalleryToolItemEventArgs) Handles UltraToolbarsManager1.GalleryToolActiveItemChange
	' The Item property needs to be checked for Nothing, because when an item has been
	' activated, and the cursor has left the item area of the gallery, this event
	' will be fired with a Nothing Item.
	If Not (e.Item Is Nothing) Then
		' Use the information from the event args to get the ui element showing the
		' item that was activated.
		Dim itemElement As Infragistics.Win.UIElement = e.Item.GetUIElement(e.GalleryTool, e.Group, e.ItemLocation)

		' Determine the screen location of the item's top-left corner
		Dim screenLocation As Point = itemElement.Control.PointToScreen(itemElement.Rect.Location)

		' Set the text of the form to indicate which item has been activated
		' and where it is location, both the screen location and the type of
		' gallery area it was displayed in (preview or drop down).
		Me.Text = _
		 "Live Preview activated for """ & e.Item.Title & """ in the " & _
		 e.ItemLocation.ToString() & " area at " & screenLocation.ToString()
	Else
		' If the Item is Nothing, the the cursor has left the item area and there 
		' is no longer an active item.
		Me.Text = "Live Preview deactivated from the " & e.ItemLocation.ToString() & " area"
	End If
End Sub
using System.Windows.Forms;
using Infragistics.Win.UltraWinToolbars;

private void button1_Click( object sender, EventArgs e )
{
	// Get the gallery from the toolbars manager whose item will be customized
	PopupGalleryTool gallery = (PopupGalleryTool)this.ultraToolbarsManager1.Tools[ "PopupGalleryTool1" ];

	// Set the delay for activating the first item in the gallery.  The user can mouse over
	// various items, but if they leave the item before 1000ms has ellapsed, the 
	// GalleryToolActiveItemChange event will never fire.  However, if the user does hover 
	// over an item for 1000ms, the event will fire and the ActivationActionDelay will be used
	// to determine how long to wait to activate other items.
	// NOTE: When UltraToolbarsManager.Office2007UICompatibility is true, these delays will 
	// automatically be resolved to 250ms and 0ms, respectively, for gallery previews in the ribbon.
	gallery.ActivationInitialActionDelay = 1000;

	// After the first item has been activated, subsequent items will be activated immediately
	gallery.ActivationActionDelay = 0;
}

private void ultraToolbarsManager1_GalleryToolActiveItemChange( object sender, GalleryToolItemEventArgs e )
{
	// The Item property needs to be checked for null, because when an item has been
	// activated, and the cursor has left the item area of the gallery, this event
	// will be fired with a null Item.
	if ( e.Item != null )
	{
		// Use the information from the event args to get the ui element showing the
		// item that was activated.
		Infragistics.Win.UIElement itemElement = 
			e.Item.GetUIElement( e.GalleryTool, e.Group, e.ItemLocation );

		// Determine the screen location of the item's top-left corner
		Point screenLocation = itemElement.Control.PointToScreen( itemElement.Rect.Location );

		// Set the text of the form to indicate which item has been activated
		// and where it is location, both the screen location and the type of
		// gallery area it was displayed in (preview or drop down).
		this.Text = 
			"Live Preview activated for \"" + e.Item.Title + "\" in the " + 
			e.ItemLocation.ToString() + " area at " + screenLocation.ToString();
	}
	else
	{
		// If the Item is null, the the cursor has left the item area and there 
		// is no longer an active item.
		this.Text = "Live Preview deactivated from the " + e.ItemLocation.ToString() + " area";
	}
}
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