Version

MergeType Property

Gets or sets a value that indicates how the tool behaves when it has the same key as another tool being merged.
Syntax
'Declaration
 
Public Property MergeType As MenuMergeType
public MenuMergeType MergeType {get; set;}

Property Value

A value that indicates how the tool behaves when it has the same key as another tool being merged.
Exceptions
ExceptionDescription
System.NotSupportedExceptionThe property is modified at design-time for a tool in an UltraToolbarsManager defined on a base Form or UserControl. Inherited tools must be modified at run-time or at design-time through the designer of the Form or UserControl they were created on.
System.ComponentModel.InvalidEnumArgumentExceptionThe value assigned is not defined in the MenuMergeType enumeration or the value assigned is MergeItems and the associated tool is not a PopupMenuTool.
Remarks

When two UltraToolbarsManagers are merged, each root tool from the child manager is merged into the parent manager. The MergeType of the tool on the child manager is used to determine how to merge the tools. If that MergeType is Default and there exists a tool with the same key and type on the parent manager, the parent tool's MergeType is used. If there is no parent tool or the parent tool's MergeType is also Default, the ToolBase.DefaultMergeType of the tool on the child manager is used. The table below describes how merging will take place depending on the value of this resolved MergeType:

MergeType Result
Add Tool instances from the child manager are added to containers associated with their own on the parent manager.
MergeItems All submenu tools of a menu on the child manager are merged with the submenu tools of a menu with the same key and type on the parent manager. This setting only applies to menus.
Remove Tool instances on the parent manager with the same key and type as the tool from the child manager are removed.
Replace The tool on the child manager replaces all tools on the parent manager with the same key and type.
Default The resolved MergeType should never be Default.

Example
The following code demonstrates how to access some of the information passed in the event arguments of the ToolClick event.

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

	Private Sub UltraToolbarsManager1_ToolClick(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinToolbars.ToolClickEventArgs) Handles UltraToolbarsManager1.ToolClick

		Debug.WriteLine("The Tool with key '" + e.Tool.Key + "' has been clicked.  It is of type: '" + e.Tool.GetType().ToString() + "'")


		' Display property information for the tool that was clicked.
		Debug.IndentLevel += 1


		' Display all the properties of the tool's SharedProps object.
		Debug.WriteLine("SharedProps properties ------------------------------------------")


		' SharedProps.AllowMultipleInstances
		If e.Tool.SharedProps.AllowMultipleInstances = False Then
			Debug.WriteLine("Only one instance of this tool may be created!")
		End If

		Debug.WriteLine("Caption: '" + e.Tool.SharedProps.Caption)
		Debug.WriteLine("Tool has been assigned to category: '" + e.Tool.SharedProps.Category)
		Debug.WriteLine("The description that will be displayed for this tool in the runtime customizer is: '" + e.Tool.SharedProps.CustomizerCaption)
		Debug.WriteLine("DisplayStyle: '" + e.Tool.SharedProps.DisplayStyle.ToString())
		Debug.WriteLine("The enabled status for this tool is: '" + e.Tool.SharedProps.Enabled.ToString())
		Debug.WriteLine("MaxWidth: '" + e.Tool.SharedProps.MaxWidth.ToString())
		Debug.WriteLine("MinWidth: '" + e.Tool.SharedProps.MinWidth.ToString())
		Debug.WriteLine("The MergeOrder for this tool is: '" + e.Tool.SharedProps.MergeOrder.ToString())
		Debug.WriteLine("The MergeType for this tool is: '" + e.Tool.SharedProps.MergeType.ToString())
		Debug.WriteLine("The Priority for this tool when determining if it can be displayed on a toolbar with limited space is: '" + e.Tool.SharedProps.Priority.ToString())
		Debug.WriteLine("The Shortcut key combination associated with this tool is: '" + e.Tool.SharedProps.Shortcut.ToString())
		Debug.WriteLine("Spring: '" + e.Tool.SharedProps.Spring.ToString())
		Debug.WriteLine("Total # of instances of this tool: '" + e.Tool.SharedProps.ToolInstances.Count.ToString())
		Debug.WriteLine("ToolTipText: '" + e.Tool.SharedProps.ToolTipText.ToString())
		Debug.WriteLine("Visible: '" + e.Tool.SharedProps.Visible.ToString())
		Debug.WriteLine("Width: '" + e.Tool.SharedProps.Width.ToString())

		If e.Tool.SharedProps.ShowInCustomizer = False Then
			Debug.WriteLine("This tool will NOT be shown in the runtime customizer.")
		End If

		Debug.IndentLevel -= 1

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

		private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
		{

			Debug.WriteLine("The Tool with key '" + e.Tool.Key + "' has been clicked.  It is of type: '" + e.Tool.GetType().ToString() + "'");


			// Display property information for the tool that was clicked.
			Debug.IndentLevel++;


			// Display all the properties of the tool's SharedProps object.
			Debug.WriteLine("SharedProps properties ------------------------------------------");


			// SharedProps.AllowMultipleInstances
			if (e.Tool.SharedProps.AllowMultipleInstances == false)
				Debug.WriteLine("Only one instance of this tool may be created!");

			Debug.WriteLine("Caption: '" + e.Tool.SharedProps.Caption);
			Debug.WriteLine("Tool has been assigned to category: '" + e.Tool.SharedProps.Category);
			Debug.WriteLine("The description that will be displayed for this tool in the runtime customizer is: '" + e.Tool.SharedProps.CustomizerCaption);
			Debug.WriteLine("DisplayStyle: '" + e.Tool.SharedProps.DisplayStyle.ToString());
			Debug.WriteLine("The enabled status for this tool is: '" + e.Tool.SharedProps.Enabled.ToString());
			Debug.WriteLine("MaxWidth: '" + e.Tool.SharedProps.MaxWidth.ToString());
			Debug.WriteLine("MinWidth: '" + e.Tool.SharedProps.MinWidth.ToString());
			Debug.WriteLine("The MergeOrder for this tool is: '" + e.Tool.SharedProps.MergeOrder.ToString());
			Debug.WriteLine("The MergeType for this tool is: '" + e.Tool.SharedProps.MergeType.ToString());
			Debug.WriteLine("The Priority for this tool when determining if it can be displayed on a toolbar with limited space is: '" + e.Tool.SharedProps.Priority.ToString());
			Debug.WriteLine("The Shortcut key combination associated with this tool is: '" + e.Tool.SharedProps.Shortcut.ToString());
			Debug.WriteLine("Spring: '" + e.Tool.SharedProps.Spring.ToString());
			Debug.WriteLine("Total # of instances of this tool: '" + e.Tool.SharedProps.ToolInstances.Count.ToString());
			Debug.WriteLine("ToolTipText: '" + e.Tool.SharedProps.ToolTipText.ToString());
			Debug.WriteLine("Visible: '" + e.Tool.SharedProps.Visible.ToString());
			Debug.WriteLine("Width: '" + e.Tool.SharedProps.Width.ToString());

			if (e.Tool.SharedProps.ShowInCustomizer == false)
				Debug.WriteLine("This tool will NOT be shown in the runtime customizer.");


			Debug.IndentLevel--;

		}
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