Show/hide XPMenus ParentBarItem

I am trying to programatically show/hide a top-level ParentBarItem in an XPMenus MDI application. Initially, I want the menu item to be hidden. I added a ParentBarItem to both the main Form and the MDI child Form menus. By invoking a command, I programatically do this in the main Form: ParentBarItem mi = mainFrameBarManager.GetMergedEquivalent(miExtras, miExtras); bool bVisible = mi.Visible; mi.Visible = !bVisible; Nothing ever happens. I never see the miExtras become visible. I can see that the Visible property toggles from true/false, but there is no visible change in the Form. It doesn''t matter if a child Form is visible or not. Same behavior. Any ideas on how to make this happen?

3 Replies

MJ Mano J Syncfusion Team February 24, 2006 05:02 AM UTC

Hi Pete, Thanks for using Essential Tools. I have tested this issue here. I am afraid, the code that you have used works fine. It correctly toggles the parentBarItem visiblity. I have attached the tested sample. In the sample, you can toggle the visibility using a checkbox. Please refer to it and let me know if I have missed anything. Regards, Mano Test_menus_forum.zip


PM Peter Moss February 24, 2006 05:59 PM UTC

Mano, Thanks for the reply. In parallel, I was starting to put together a sample app to test this. I came to the same conclusion that you did. In the simple app, it works just fine. So I had to go back to our real app and puzzle it out some more. I think I found out what the issue was. Our base class Form is in 1 assembly. I added the Extras menu there. But the final instance of this is a subclassed Form implemented in another assembly. When I brought that Form up in the designer, I saw that the menu I added was not visible. I had to manually add it. This added a new entry in the barMainMenu.UpdatedBarItemPositions array. To be honest, I''m not sure why I should have to do this in the subclassed Form when I added it as a protected item in the base class. But after I did this, the original code worked as you say. Can you explain the need to do this in the subclassed Form? Anyway, thank you for the help. Pete >Hi Pete, > >Thanks for using Essential Tools. > >I have tested this issue here. I am afraid, the code that you have used works fine. It correctly toggles the parentBarItem visiblity. I have attached the tested sample. In the sample, you can toggle the visibility using a checkbox. > >Please refer to it and let me know if I have missed anything. > >Regards, >Mano > >Test_menus_forum.zip >


MJ Mano J Syncfusion Team February 27, 2006 12:46 PM UTC

Hi Pete, Please refer to the link below that explains the need to make XPMenus protected or public while inherting it. The corresponding components like the BarManager and toolbar should however be protected or public for this visual inheritance to be supported. http://www.syncfusion.com/library/menuswindows/visualinheritancesupport.html Please let me know if you have any questions. Thank you for using Syncfusion products. Regards, Mano

Loader.
Up arrow icon