Hai .....,
I have designed a User control, a custom MenuItem, that is inherited from MenuItem. Now when the user adds my MenuItem to the mainMenu1 (MenuBar), I don't want to do anything to my custom menuitem control and leave it to its default behaviour. How can I determine that my custom menuitem control is on the menubar or not
Regards,
Hemant

Determine if a MenuItem is on MenuBar
eddy1421
You could try using the Parent property of the menuItem. This property contains a Menu object if it is placed in a menu...
cheers,
Paul June A. Domag
Dave Balsillie
bool isTopLevelMenu = this.Parent is MainMenu;
If someone has derived from MainMenu, then your check will not work.
gaozhi
Hai I did this as per u r suggestion and bingo
bool isTopLevelMenu = this.Parent.GetType() == typeof(MainMenu);
Regards,
Hemant