如何保存在 Outlook Explorer Window 中进行的功能区设置并在 Outlook MailItem Window 中显示和使用它们?

How Can I save Ribbon Settings made in the Outlook Explorer Window and also display und use them in the Outlook MailItem Window?

对于我的 Outlook 加载项,我使用 XML 和几个 OnAction 方法创建了一个功能区。 我的功能区有切换按钮,在激活时会启用多个功能。 我的问题是,如果用户单击 Outlook 资源管理器 Window 功能区中的按钮,然后创建新邮件(打开 MailItem Window),则在功能区中进行的设置Explorer Window 未转移到 MailItem Window.

的功能区

这是探索者的勋带Window:

这是 MailItem 的功能区 Window:

您需要为功能区上的 toggleButton 控件指定 getPressed 回调。它使您能够指定是否按下切换按钮控件。回调具有以下签名:

C#: bool GetPressed(IRibbonControl control)

VBA: Sub GetPressed(control As IRibbonControl, ByRef returnValue)

C++: HRESULT GetPressed([in] IRibbonControl *pControl, [out, retval] VARIANT_BOOL *pvarfPressed)

Visual Basic: Function GetPressed(control As IRibbonControl) As Boolean

因此,当有人点击资源管理器上的按钮时 window 您可以使用布尔变量保存状态(如何维护状态由您决定)并在 getPressed 回调中您可以 return 缓存值。

在以下系列文章中阅读有关 Fluent UI(又名功能区 UI)的更多信息: