We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Save the menu state to the default location

I wish to hide a toolbar from code. After which I wish to persist the state of the toolbar, so when I next open the application the toolbar remains hidden. However I am have trouble do this. When I hide the toolbar from using the Toolbar list popup it works, but not from code. I am using the following method for saving the state, but appears not to be working. //save the changes, AppStateSerializer serializer = AppStateSerializer.GetSingleton(); mBarManager.SaveBarState(serializer);

2 Replies

DV David Vanstone June 16, 2006 01:47 PM UTC

Changed my code to mBarManager.GetCommandBarManager().SetBarVisibility(bar,visible);


J. J.Nagarajan Syncfusion Team June 17, 2006 06:51 AM UTC

Hi David, The SaveBarState/LoadBarState methods persist the positional information of the menus/toolbars only. Hiding/showing or adding/removing BarItems/toolbars amounts to menu customization and the MainFrameBarManager''''s protected methods - LoadCustomizationInfo / SaveCustomizationInfo handle this.You have to derive a custom mainframeBarManager and use these methods to persist customization. Set the following properties to false and then load the state from a serialized file. This way all the state persistance is done to the same xml file. this.mainFrameBarManager1.AutoLoadToolBarPositions = false; this.mainFrameBarManager1.AutoPersistCustomization = false; //to programatically hide the bars mainFrameBarManager1.GetCommandBarManager().SetBarVisibility(bar1,false); mainFrameBarManager1.GetCommandBarManager().SetBarVisibility(bar2,false); I have attached a sample which demonstrate this completely.In this sample when you click on "New" baritem the bar1 and bar2 will be hidden.When you click on "save" and "Load" buttons to save and load the customized informations. Please let me know if this meets your requirements. Thank you, J.Nagaraj. persistCustomization.zip

Loader.
Live Chat Icon For mobile
Up arrow icon