The blog has moved to a new address. The blog is now located at

Wednesday, June 14, 2006

Creating clonable menu items in .Net 2.0 ( Implementing CloneMenu method )

In Windows Forms FAQ( .Net 2.0) I found that the CloneMenu method is not implemented ...:-(

"With the entire ToolStrip family of controls we do not have an integrated commanding
architecture nor do we support cloning of items to appear in multiple places.
We do support reusing the same ToolStripDropDown or ContextMenuStrip in multiple places (non-nested).
We understand this may require more state management and maintenance code and are looking
at ways to improve this in the future.
Erick Ellis, 6 January 2005 # (MS)"

Here's "fast and dirty" solution:

using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

namespace WindowsApplication66
class CloneToolStripLabel:ToolStripLabel
public CloneToolStripLabel( string text )
: base(text)
public CloneToolStripLabel CloneMenu()
return ( CloneToolStripLabel )this.MemberwiseClone();


CloneToolStripLabel menuItem = new CloneToolStripLabel("Kuku");

Also you can read this post

Technorati : , , ,
Ice Rocket : , , ,

No comments: