I am converting my ribbon from visual designer to XML and I am not sure how to change the state of the ribbon toggle button from other parts of the project. Previously, when I close my task pane via the close button on the task pane:
private void btnClose_Click(object sender, EventArgs e)
{
Globals.ThisWorkbook.Application.DisplayDocumentActionTaskPane = false;
Globals.Ribbons.Ribbon.btnTaskPane.Checked = false;
}
Now, that the code is in XML and the callback is:
public bool btnTaskPaneToggled(Office.IRibbonControl control)
{
if (Globals.ThisWorkbook.Application.CommandBars["Task Pane"].Visible)
return true;
else
return false;
}
XML for toggle button:
<toggleButton id="btnTaskPane"
onAction="btnTaskPane_Click"
getPressed="btnTaskPaneToggled"
screentip="Task Pane"
supertip="Toggle Task Pane on and off."
label="&Task Pane"
size="large"
getImage="GetIcon" />
How do I call the Ribbon callback from the close button?
Aucun commentaire:
Enregistrer un commentaire