I tried to remove all ribbon buttons from QAT and add some new ribbon buttons into QAT, but it didn't work. The following is my source code:
void UpdateQAT ()
{
// Remove all ribbon buttons from QAT
this.quickAccessToolbar.Items.Clear();
// Create a new ribbon button instance
RibbonButton RibbonButton = new RibbonButton();
RibbonButton.SmallIcon = new BitmapImage(new Uri("/Resources/Redo16.png", UriKind.Relative));
RibbonButton.SizeForm = SizeForm.ExtraSmall;
// Create a new QuickAccessToolBar object
QuickAccessToolBar QAT = new QuickAccessToolBar();
// Add the new ribbon button into the QAT's items
QAT.Items.Add(RibbonButton);
// Let the QAT control reference the new QAT object
this.qat = QAT;
}
Is that a right way to do that? Otherwise, how to do it?
Another question, I added a few ribbon buttons in a group into QAT at once, there would be a new button like splitbutton in the QAT, I clicked the new splitbutton in QAT, and hit one item in the dropdown list, nothing happened, it looked like the mouse click event was not been triggered. Is it a bug? Otherwise how to triger the mouse click event?