Specify the Index Parameter
 
 
 

The Index parameter is an integer that specifies the position of the new menu item within the menu. The index begins with position zero (0) as the first position on the menu after the title. To add the new menu item to the end of a menu, set the Index parameter equal to the Count property of the menu. (The Count property of the menu represents the total number of menu items on that menu.)

The first index position is zero (0) and the separators are listed as individual menu items with their own index position. The Count property for the menu pictured would be six (6). To add a menu item between Tile Horizontally and Tile Vertically, set the Index parameter to two (2), which is the index of the Tile Vertically menu item. This inserts your new menu item into index two (2) and bumps all the remaining menu items down one index position.

Once a menu item has been created, you cannot change the index of the menu item through the Index property. To change the index of an existing menu item you must delete and re-add the menu item to a different position, or add or delete surrounding menu items until a proper placement is achieved.