Version

ShowPopup(String) Method

Displays the PopupToolBase as a context popup at the current mouse position.
Syntax
'Declaration
 
Public Overloads Sub ShowPopup( _
   ByVal popupToolKey As String _
) 
public void ShowPopup( 
   string popupToolKey
)

Parameters

popupToolKey
The key of the context popup to display.
Example
The following code creates a popup menu and uses the tool manager's ShowPopup method to show the menu at a particular screen location.

Imports System.Diagnostics
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinToolbars

	Private Sub Button24_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button24.Click

		If Me.UltraToolbarsManager1.Tools.Exists("MyContextMenu") = False Then
			' ----------------------------------------------------------------------------
			' Create a PopupMenuTool.
			Dim popupMenuTool As New PopupMenuTool("MyContextMenu")

			' Always add new tools to the UltraToolbarManager's root tools collection
			' before adding them to menus or toolbars.
			Me.UltraToolbarsManager1.Tools.Add(popupMenuTool)


			' Set some properties on the Popup menu
			PopupMenuTool.Settings.SideStripText = "Infragistics"
			PopupMenuTool.Settings.SideStripWidth = 24
			PopupMenuTool.Settings.IsSideStripVisible = DefaultableBoolean.True



			' ----------------------------------------------------------------------------
			' Create a some tools and add them to the menu .
			Dim menuButton1 As New ButtonTool("MenuButton1")
			Dim menuButton2 As New ButtonTool("MenuButton2")
			Dim menuButton3 As New ButtonTool("MenuButton3")

			' Set some properties on the tools.
			menuButton1.SharedProps.Caption = "Option 1"
			menuButton1.SharedProps.AppearancesSmall.Appearance.Image = Bitmap.FromHicon(SystemIcons.Warning.Handle)
			menuButton2.SharedProps.Caption = "Option 2"
			menuButton2.SharedProps.AppearancesSmall.Appearance.Image = Bitmap.FromHicon(SystemIcons.Application.Handle)
			menuButton3.SharedProps.Caption = "Option 3"
			menuButton3.SharedProps.AppearancesSmall.Appearance.Image = Bitmap.FromHicon(SystemIcons.Information.Handle)


			' Always add new tools to the UltraToolbarManager's root tools collection
			' before adding them to menus or toolbars.
			Me.UltraToolbarsManager1.Tools.AddRange(New ToolBase() {menuButton1, menuButton2, menuButton3})

			' Add the tools to the popup menu
			popupMenuTool.Tools.AddToolRange(New String() {"MenuButton1", "MenuButton2", "MenuButton3"})


			' Show and position the popup so that its upper left corner is aligned with
			' the lower left corner of the button that generated this click event.
			popupMenuTool.ShowPopup(Me.PointToScreen(New Point(Me.Button24.Left, Me.Button24.Bottom)), _
				  Me.Button24.RectangleToScreen(Me.Button24.ClientRectangle), _
				  DropDownPosition.BelowExclusionRect)
		Else
			' Show and position the popup so that its upper left corner is aligned with
			' the lower left corner of the button that generated this click event.
			Me.UltraToolbarsManager1.ShowPopup("MyContextMenu", Me.PointToScreen(New Point(Me.Button24.Left, Me.Button24.Bottom)))
		End If

	End Sub
using System.Diagnostics;
using Infragistics.Win;
using Infragistics.Win.UltraWinToolbars;

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

			if (this.ultraToolbarsManager1.Tools.Exists("MyContextMenu") == false)
			{
				// ----------------------------------------------------------------------------
				// Create a PopupMenuTool.
				PopupMenuTool popupMenuTool	= new PopupMenuTool("MyContextMenu");

				// Always add new tools to the UltraToolbarManager's root tools collection
				// before adding them to menus or toolbars.
				this.ultraToolbarsManager1.Tools.Add(popupMenuTool);


				// Set some properties on the Popup menu
				popupMenuTool.Settings.SideStripText		= "Infragistics";
				popupMenuTool.Settings.SideStripWidth		= 24;
				popupMenuTool.Settings.IsSideStripVisible	= DefaultableBoolean.True;



				// ----------------------------------------------------------------------------
				// Create a some tools and add them to the menu .
				ButtonTool	menuButton1	= new ButtonTool("MenuButton1");
				ButtonTool	menuButton2	= new ButtonTool("MenuButton2");
				ButtonTool	menuButton3	= new ButtonTool("MenuButton3");

				// Set some properties on the tools.
				menuButton1.SharedProps.Caption	= "Option 1";
				menuButton1.SharedProps.AppearancesSmall.Appearance.Image = Bitmap.FromHicon(SystemIcons.Warning.Handle);
				menuButton2.SharedProps.Caption	= "Option 2";
				menuButton2.SharedProps.AppearancesSmall.Appearance.Image = Bitmap.FromHicon(SystemIcons.Application.Handle);
				menuButton3.SharedProps.Caption	= "Option 3";
				menuButton3.SharedProps.AppearancesSmall.Appearance.Image = Bitmap.FromHicon(SystemIcons.Information.Handle);


				// Always add new tools to the UltraToolbarManager's root tools collection
				// before adding them to menus or toolbars.
				this.ultraToolbarsManager1.Tools.AddRange(new ToolBase [] {menuButton1, menuButton2, menuButton3} );

				// Add the tools to the popup menu
				popupMenuTool.Tools.AddToolRange(new string [] {"MenuButton1", "MenuButton2", "MenuButton3"} );


				// Show and position the popup so that its upper left corner is aligned with
				// the lower left corner of the button that generated this click event.
				popupMenuTool.ShowPopup(this.PointToScreen(new Point(this.button24.Left, this.button24.Bottom)),
											  this.button24.RectangleToScreen(this.button24.ClientRectangle),
	  										  DropDownPosition.BelowExclusionRect);
			}
			else
			{
				// Show and position the popup so that its upper left corner is aligned with
				// the lower left corner of the button that generated this click event.
				this.ultraToolbarsManager1.ShowPopup("MyContextMenu", this.PointToScreen(new Point(this.button24.Left, this.button24.Bottom)));
			}

		}
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