Search code examples
outlookoutlook-addincustomtaskpane

CustomTaskPane Visibility in Outlook


I have a custom TaskPane in Outlook. When the user toggles the visibility, I record it in the settings object so that the next time Outlook starts it will be shown/hidden as the user left it.

CustomTaskPane.VisibleChanged is raised in each of the following scenarios

  1. The user clicks the X in the top right corner of the task pane
  2. TaskPane.Visible is set in response to the user pressing a toggle button in the ribbon
  3. The user presses the File menu button on the top left

The first two ways, the user clearly meant to hide the task pane. The third way the user was just trying to go to the menu screen (perhaps on their way to hit the Exit button).

Question

Is there anyway to determine that the event was raised because of the File Menu? Any way to programatically determine if the File Menu is currently open?

Here's what I mean by the File Menu Screen:

File Menu Screen


Solution

  • The Backstage UI provides two callbacks that can be used for tracking when the File menu is open and closed:

    • onShow - The Backstage view is displayed which triggers the OnShow callback procedure.
    • onHide - when the Backstage view is not longer visible.

    The onShow attribute and the onHide attribute of the element can point to code that performs that kind of action.

    <backstage onShow="OnShow"> 
    

    See Customizing the Office 2010 Backstage View for Developers for more information.