/// <summary> /// Event handler for the context menu for stripe header /// </summary> /// <remarks>We show only a simple context menu that demonstrates the <see cref="TableEditorInputMode.InsertChild"/> convenience method.</remarks> private void graphEditorInputMode_PopulateItemContextMenu(object sender, PopulateItemContextMenuEventArgs <IModelItem> e) { if (!e.Handled) { var stripe = GetStripe(e.QueryLocation); if (stripe != null) { var deleteItem = new ToolStripMenuItem { Text = "Delete " + stripe.Stripe }; deleteItem.SetCommand(Commands.Delete, stripe.Stripe, graphControl); e.Menu.Items.Add(deleteItem); var insertBeforeItem = new ToolStripMenuItem { Text = "Insert new stripe before " + stripe.Stripe }; insertBeforeItem.Click += delegate { IStripe parent = stripe.Stripe.GetParentStripe(); int index = stripe.Stripe.GetIndex(); tableEditorInputMode.InsertChild(parent, index); }; e.Menu.Items.Add(insertBeforeItem); var insertAfterItem = new ToolStripMenuItem { Text = "Insert new stripe after " + stripe.Stripe }; insertAfterItem.Click += delegate { IStripe parent = stripe.Stripe.GetParentStripe(); int index = stripe.Stripe.GetIndex(); tableEditorInputMode.InsertChild(parent, index + 1); }; e.Menu.Items.Add(insertAfterItem); e.Handled = true; } } }