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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Saving Toolbars location to xml

Thread ID:

Created:

Updated:

Platform:

Replies:

56696 Feb 19,2007 06:01 PM UTC Dec 28,2007 11:22 PM UTC WinForms 5
loading
Tags: Tools
Vijaya Kumar Reddy
Asked On February 19, 2007 06:01 PM UTC

Hi,

Is there any way we can serialize the Toolbars location and any other related info to an XML file other than Isolated Storage?

Regards
Vijay

Gopalakrishnan S [Syncfusion]
Replied On February 19, 2007 08:37 PM UTC

Hi Vijay,

Thanks for using Syncfusion products.

You can use BarManager's SaveBarState() and LoadBarState() method to save and load the toolbar states. If you want to persist the bar state into a local folder instead of Isolated Storage, first you have to set the MainFrameBarManager's AutoPersistCustomization and AutoLoadToolBarPositions property to false.

Here is the code snippet:

// Load the Saved Bar Information
private void Form1_Load(object sender, System.EventArgs e)
{
AppStateSerializer serializer = new AppStateSerializer(SerializeMode.XMLFile, "..//..//StateInfo");
this.mainFrameBarManager1.LoadBarState(serializer);
}

// Save the Bar State Information
private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
AppStateSerializer serializer = new AppStateSerializer(SerializeMode.XMLFile, "..//..//StateInfo");
this.mainFrameBarManager1.SaveBarState(serializer);
serializer.PersistNow();
}

Sample

Please refer to the attachments and let me know if you have any questions.

Regards,
S.Gopal.

Klaus Ziegler
Replied On October 23, 2007 01:25 PM UTC

Hello,

I would also work without the isolated storage and use the method LoadBarState and SaveBarState. I would like to customize a toolbar and the mainmenu, e.g. rename a menuentry. If I set the AutoPersistCustomization = true all works fine, but the information is saved in xml-file and the isolated storage. If I set the AutoPersistCustomization = false nothing works. The information is in the xml-file and nothing in the isolated storage, but if I restart the application, this means I load the bar state, the customization is lost.
How can I work with a XML-File without using the isolated storage.
I tested this also with the sample "Windows\Diagram.Windows\Samples\2.0\In Depth\DiagramBuilder".

Regards
Klaus

Jeba S [Syncfusion]
Replied On October 25, 2007 11:36 AM UTC

Hi Klaus,

Please follow the Direct-Trac incident 38563 for this query.

Thank you for using Syncfusion Products.

Best Regards,
Jeba.

Craig Stephens
Replied On November 9, 2007 10:48 PM UTC

I'm having the same type of problem as Klaus. Has there been any resolution?

Using the sample application provided in this thread:

1. Open app.
2. Remove a button from the toolbar.
3. Close app.
4. Open app.
5. Button that was removed is back when it should not be.


J.Nagarajan [Syncfusion]
Replied On December 28, 2007 11:22 PM UTC

Hi Craig ,

The SaveBarState/LoadBarState methods deal with 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.

So in your sample you should set

this.mainFrameBarManager1.AutoLoadToolBarPositions = false;
this.mainFrameBarManager1.AutoPersistCustomization = false;

and then load the state from the serialized file. The way all the state persistance is done to the same xml file.

http://websamples.syncfusion.com/samples/Tools.Windows/F56696/main.htm

Please take a look at the sample and let me know if you have any questions. Thanks.

Best regards,
Nagaraj


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;