none
How to update VSTO Ribbon in all Forms/Windows when out of Focus RRS feed

  • Question

  • I have a ribbon menu who's buttons are enabled/disable given a certain criteria (external web api disconnects). This Ribbon menu is present on ReadMail,Explorer,NewMail.

    I've implemented both the Ribbon XML and Ribbon Visual Designer controls to test out BOTH UIs. Obviously only one works at a time.

    When the VSTO gets loaded on Outlook. Only the ACTIVE/FOCUSED window will be updated. All foreground/background windows are never updated visually. They only get updated when THAT WINDOW is in focus.

    Example Visual Designer Code:

    private void OutlookManager_ConnectionChanged()
    {
        // Disable all buttons if OutlookManager informs not connected
        this.homeDeleteBtn.Enabled = OutlookManager.IsConnected;
        this.homeFilePrivatelyBtn.Enabled = OutlookManager.IsConnected;
        this.homeFilePublicallyBtn.Enabled = OutlookManager.IsConnected;
        this.homeRepairBtn.Enabled = OutlookManager.IsConnected;
        this.homeSyncEmailBtn.Enabled = OutlookManager.IsConnected;
    }

    Example RibbonXML Code:

    private void OutlookManager_ConnectionChanged() { // Invalidate Ribbon to refresh the UI if (ribbon != null) { ribbon.Invalidate(); } }

    // Set to the Enabled property on XML code public bool IsRibbonButtonEnabled(Office.IRibbonControl rControl) { // Disable all buttons if OutlookManager informs not connected return OutlookManager.IsConnected); }




    • Edited by Arscott Monday, February 8, 2016 12:36 PM
    Monday, February 8, 2016 12:34 PM

Answers