Saving ribbon settings and conflict with Backstage View

Posted by: agulik on 24 April 2023, 5:46 pm EST

  • Posted 24 April 2023, 5:46 pm EST

    I have a Winforms applcation using the 4.8 C1RIbbon and backstage view. I would like to save my ribbon settings when closing down the application and load them when starting up again. I am attempting to do so by calling C1Ribbon.Save(“ribbonsettings_filename.xml”) in .FormClosing and load it up by calling C1Ribbon.Load(“ribbonsettings_filename.xml”) in .FormLoad

    However, I’ve found that this results in a unhandled exception if I try to do so. I narrowed it down to what seems to be a conflict with the Backstage View.

    If I do .Load() before trying to open my backstage view, I get a ribbon that has no ability to open the backstage view. If I do .Load() after opening the backstage view, I get an unhandled exception and the application hangs.

    What is the recommended way to save and load Ribbon settings such as icons in the QAT, position of QAT, and whether the ribbon is minimized?

  • Posted 24 April 2023, 6:41 pm EST

    Further information that be helpful/relevant:

    I noticed when opening the ribbon settings XML file that I got from .Save(), that there is nothing about the backstage view. So it doesn’t seem like there is any way to capture the setup of the backstage view when saving to XML.

    The progression is:

    1. Application closes, calling .Save() as the form closes.
    2. Application starts up with ribbon set up as it is defined in designer. This includes a C1BackstageView with its LeftPane, LeftBottomPane, etc. filled with items.
    3. .Load() is called
    4. C1BackstageView still exists as an object but it has nothing in it and it is not connected to C1Ribbon.
  • Posted 25 April 2023, 5:17 am EST

    Hi,

    Thank you for providing all the details. We could see the behavior you mentioned on our end. We have shared all the observations with the development team for further investigation and will let you know the updates as soon as possible.

    [Internal Tracking ID: C1WIN-29602]

    Best Regards,

    Kartik

  • Posted 25 April 2023, 6:03 am EST

    Hi Agulik,

    which settings do you want to save? The ribbon items are usually at design time and cannot be modified by users.

    I can imagine e.g. the items added to the Qat, or the expanded state.

    C1Ribbon.Save saves the full layout, including all items. If you restore it this way, you would create completely new buttons - and I assume e.g. attached event handlers for button clicks would be lost this way.

    Best regards

    Wolfgang

  • Posted 25 April 2023, 6:07 am EST

    Sorry, I had the page open while Kartik wrote his reponse, and I didn’t fully read the initial post.

    But my last reply about not to use “C1Ribbon.Save” is still valid I think.

    To save the items added to the Qat: save/restore the property “C1Ribbon.QatItemNames”.

    To save the expanded state, use the property “C1Ribbon.Minimized”

    Does this help?

    Wolfgang

  • Posted 25 April 2023, 9:53 pm EST

    Thanks, I was able to get it working with QatItemNames, Minimized, and BelowRibbon.

    Best,

    Andrew

  • Posted 25 October 2023, 8:43 am EST

    Hi Andrew,

    Apologies for the delay in response. This issue has been fixed in the latest 2023v2 (620) hotfix release.

    Best Regards,

    Kartik

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels