This documentation is archived and is not being maintained.

ToolStripItem.MergeIndex Property

Gets or sets the position of a merged item within the current ToolStrip.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

public int MergeIndex { get; set; }
/** @property */
public int get_MergeIndex ()

/** @property */
public void set_MergeIndex (int value)

public function get MergeIndex () : int

public function set MergeIndex (value : int)

Not applicable.

Property Value

An integer representing the index of the merged item, if a match is found, or -1 if a match is not found.

Use the MergeIndex property to get or set the index of a ToolStripMenuItem so that you can access it for menu-merging operations.

The following example uses the MergeIndex property to insert a merged ToolStripMenuItem in a specific location. This example is part of a larger example available in the ToolStripManager class overview.

public void ShowInsertInSameLocationSample()
{
    // Notice how the items are in backward order.  
    // This is because "merge-one" gets applied, then a search occurs for the new second position 
    // for "merge-two", and so on.
    foreach (ToolStripItem item in cmsItemsToMerge.Items)
    {
        item.MergeAction = MergeAction.Insert;
        item.MergeIndex = 2;
    }
}

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0
Show: