The way to do this dynamically is using a callback.
In your ribbon XML:
<tab id="myTabID" getLabel="myCallback">
....
</tab>
In your ribbon code:
public string myCallback(IRibbonControl control)
{
switch (control.Id)
{
case "myTabID":
return "My Label";
case "whatever else":
default:
return "n/a";
}
}
The callback will execute whenever the tab is displayed, so probably on startup. When you actually want to change what's showing, you have to invalidate it:
ribbon.Invalidate();
// or
ribbon.InvalidateControl(id);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…