title: Child ContextMenuStrip
body: <p>I have a container with a control inside. I have a ContextMenuStrip assigned to both of these.
  What I want to happen is for the contextmenu of the control to also contain all the items from the container.
  However, when I try</p>
  
  <pre><code>ToolStripManager.Merge(this.ContextMenuStrip, this.Parent.ContextMenuStrip);
  </code></pre>
  
  <p>The contextmenu for the whole container is removed</p>
  
  <p>EDIT: OK, I guess I need to clarify.
  The code I have works to some extent.
  this.ContextMenuStrip is a property of the control to which I have assigned one menu, and this.Parent.ContextMenuStrip I have assigned a different menu. When I merge them, all of the items of the parent's menu show up in the child's menu, but the parent no longer has a menu.</p>
  
  <p>This is how I set the menus:</p>
  
  <pre><code>this.ContextMenuStrip = contextmenu1;
  this.Parent.ContextMenuStrip = contextmenu2;
  </code></pre>
  
  <p>OK, here's the code</p>
  
  <p>The Form1.Designer.cs:</p>
  
  <pre><code>namespace FailExample
  {
      partial class Form1
      {
          /// &lt;summary&gt;
          /// Required designer variable.
          /// &lt;/summary&gt;
          private System.ComponentModel.IContainer components = null;
  
          /// &lt;summary&gt;
          /// Clean up any resources being used.
          /// &lt;/summary&gt;
          /// &lt;param name="disposing"&gt;true if managed resources should be disposed; otherwise, false.&lt;/param&gt;
          protected override void Dispose(bool disposing)
          {
              if (disposing &amp;&amp; (components != null))
              {
                  components.Dispose();
              }
              base.Dispose(disposing);
          }
  
          #region Windows Form Designer generated code
  
          /// &lt;summary&gt;
          /// Required method for Designer support - do not modify
          /// the contents of this method with the code editor.
          /// &lt;/summary&gt;
          private void InitializeComponent()
          {
              this.components = new System.ComponentModel.Container();
              this.button1 = new System.Windows.Forms.Button();
              this.contextMenuStrip2 = new System.Windows.Forms.ContextMenuStrip(this.components);
              this.item2ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
              this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
              this.item1ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
              this.contextMenuStrip2.SuspendLayout();
              this.contextMenuStrip1.SuspendLayout();
              this.SuspendLayout();
              // 
              // button1
              // 
              this.button1.ContextMenuStrip = this.contextMenuStrip2;
              this.button1.Location = new System.Drawing.Point(86, 82);
              this.button1.Name = "button1";
              this.button1.Size = new System.Drawing.Size(75, 23);
              this.button1.TabIndex = 0;
              this.button1.Text = "button1";
              this.button1.UseVisualStyleBackColor = true;
              // 
              // contextMenuStrip2
              // 
              this.contextMenuStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
              this.item2ToolStripMenuItem});
              this.contextMenuStrip2.Name = "contextMenuStrip2";
              this.contextMenuStrip2.Size = new System.Drawing.Size(105, 26);
              // 
              // item2ToolStripMenuItem
              // 
              this.item2ToolStripMenuItem.Name = "item2ToolStripMenuItem";
              this.item2ToolStripMenuItem.Size = new System.Drawing.Size(104, 22);
              this.item2ToolStripMenuItem.Text = "Item2";
              // 
              // contextMenuStrip1
              // 
              this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
              this.item1ToolStripMenuItem});
              this.contextMenuStrip1.Name = "contextMenuStrip1";
              this.contextMenuStrip1.Size = new System.Drawing.Size(105, 26);
              // 
              // item1ToolStripMenuItem
              // 
              this.item1ToolStripMenuItem.Name = "item1ToolStripMenuItem";
              this.item1ToolStripMenuItem.Size = new System.Drawing.Size(104, 22);
              this.item1ToolStripMenuItem.Text = "Item1";
              // 
              // Form1
              // 
              this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
              this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
              this.ClientSize = new System.Drawing.Size(284, 261);
              this.ContextMenuStrip = this.contextMenuStrip1;
              this.Controls.Add(this.button1);
              this.Name = "Form1";
              this.Text = "Form1";
              this.Load += new System.EventHandler(this.Form1_Load);
              this.contextMenuStrip2.ResumeLayout(false);
              this.contextMenuStrip1.ResumeLayout(false);
              this.ResumeLayout(false);
  
          }
  
          #endregion
  
          private System.Windows.Forms.Button button1;
          private System.Windows.Forms.ContextMenuStrip contextMenuStrip2;
          private System.Windows.Forms.ToolStripMenuItem item2ToolStripMenuItem;
          private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
          private System.Windows.Forms.ToolStripMenuItem item1ToolStripMenuItem;
      }
  }
  </code></pre>
  
  <p>And the Form1.cs</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  using System.Windows.Forms;
  
  namespace FailExample
  {
      public partial class Form1 : Form
      {
          public Form1()
          {
              InitializeComponent();
          }
  
          private void Form1_Load(object sender, EventArgs e)
          {
              ToolStripManager.Merge(button1.Parent.ContextMenuStrip, button1.ContextMenuStrip);
          }
      }
  }
  </code></pre>