简体   繁体   中英

How can I save the state of a checkbox after closing my outlook AddIn?

In the backstage Ribbon of my C# Outlook AddIn I have implemented some checkboxes for the User to switch on and off the functions of the AddIn. After closing Outlook and reopen it the checkmarks in the checkboxes are not shown although the onAction methods are working and the functions are still switched on. But as a User you can't see if the functions are switched on or off because the checkmarks in the checkboxes aren't consistent to the state of the checkboxes. Can anybody help me with this?

The ribbon UI is stateless which means it doesn't save custom control states between sessions. You need to implement callbacks and return appropriate values depending on the control's state.

For example, if an add-in writer implements the getImage callback procedure for a button, the function is called once, the image loads, and then if the image needs to be updated, the cached image is used instead of recalling the procedure. This process remains in place until the add-in signals that the cached values are invalid by using the Invalidate or InvalidateControl method, at which time, the callback procedure is again called and the return response is cached. The add-in can then force an immediate update of the UI by calling the Refresh method.

Read more about the Fluent UI (aka Ribbon UI) and available callbacks in the following series of articles:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM