1

I used a ribbon XML file to create a custom tab which contains a togglebutton. The button is meant to toggle the visibility of a custom task pane and works great. The problem is that when the user close the custom task pane, the toggle button is now out of sync. How do I programmaticly access the togglebutton so I can change its IsChecked value?

Kara
  • 6,115
  • 16
  • 50
  • 57
Keith
  • 2,618
  • 4
  • 29
  • 44

1 Answers1

-1

You need to handle the VisibleChanged event. Add the following method to your ThisAddIn class - when the user closes the task pane by clicking the Close button (X), this method updates the state of the toggle button on the Ribbon.

private void taskPaneValue_VisibleChanged(object sender, System.EventArgs e)
{
    Globals.Ribbons.ManageTaskPaneRibbon.toggleButton1.Checked = 
        taskPaneValue.Visible;
}

(see more info on this in Walkthrough: Synchronizing a Custom Task Pane with a Ribbon Button)