ryan.hilliard Hilliard
Posts: 1
Joined: 2018-07-11
|
I am trying to dynamically and remove buttons from a command bar. I am able to change captions, remove child controls but I am not able to add new controls. I would greatly appreciate some assistance.
I am able to add items right after the AddinStartUpComplete but cannot add them based on user interactions.
ADXCommandBar t = adxCommandBarPopupLookup.GetCommandBar();
var b = t.IsConnected;
var j = t.Controls[0].AsPopup;
j.Caption = "I am sam";
j.UpdateCounter++;
var q = j.Controls[0].AsPopup;
q.Caption = "I am here";
q.Controls.Clear();
ADXCommandBarButton btn = new ADXCommandBarButton();
btn.Caption = "Yo Mother";
btn.Temporary = true;
q.Controls.Add(btn);
q.UpdateCounter++;
q.UpdateControlObj(this);
t.UpdateCounter++;
t.UpdateCommandBarObj(this); |
|
Andrei Smolin
Add-in Express team
Posts: 18793
Joined: 2006-05-11
|
Hello Ryan,
I assume you know that the use of Commandbar controls in Ribbon-flowered Office applications is mostly limited to the Add-ins tab and this is why using Ribbon controls is recommended in these Office versions.
As to creating commandbar controls on the fly, please check this project: http://temp.add-in-express.com/projects_pub/dynamiccontrolsexample.zip.
Is this what you are looking for?
Andrei Smolin
Add-in Express Team Leader |
|