How to set selected-item programatically for RibbonComboBox
in VSTO?
I use C#
.
i.e.
myRibbonCB.SelectedItem = "label-name";
doesnt exist.
You need to define callbacks in the ribbon and implement those callbacks in your C# code. Try the following link for a C# VSTO example: http://blogs.infoextract.in/office-ribbon-customization-vsto-using-c/
In short:
Ribbon XML:
<toggleButton id="toggleButton1" onAction="OnActionCallback" />
C#:
public void OnActionCallback(Office.IRibbonControl control, bool isPressed)
{
if (control.Id == "checkBox1")
{
MessageBox.Show("You clicked " + control.Id);
}
else
{
MessageBox.Show("You clicked a different control.");
}
}