Version

GetUIElement Method (GalleryToolItem)

Gets the Infragistics.Win.UIElement which displays this item in the specified context.
Syntax
'Declaration
 
Public Function GetUIElement( _
   ByVal galleryInstance As PopupGalleryTool, _
   ByVal owningGroup As GalleryToolItemGroup, _
   ByVal itemLocation As GalleryArea _
) As Infragistics.Win.UIElement
public Infragistics.Win.UIElement GetUIElement( 
   PopupGalleryTool galleryInstance,
   GalleryToolItemGroup owningGroup,
   GalleryArea itemLocation
)

Parameters

galleryInstance
The instance of the gallery where the item is being displayed.
owningGroup
The group in the gallery drop down where the item is being displayed. This should be null for items in the gallery preview.
itemLocation
The gallery area where the item is being displayed.
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