问题
I have a ribbon xml where I want to add something similar as in the picture. I tried create a button and connect the menu to the button but I never got the arrow indication there is a underlying menu. I have no faith at all in that button is the correct element to use. Been googling for hours now and would be happy if anyone can send me in some kind of direction. There is no problem for me to add the element in the context menu, the problem is the dynamic menu linked to the first element.
回答1:
The control type you're looking for is dynamicMenu
Here is the ribbon XML:
<dynamicMenu id="mycustomid" label="My custom label" getContent="GetMyCustomContent" />
And the code:
public string GetMyCustomContent(IRibbonControl control)
{
return "<menu xmlns=\"http://schemas.microsoft.com/office/2009/07/customui\">"
+ "<button id=\"anotherid\" label=\"another label\" onAction=\"DoWhatever\"/>"
+ "</menu>";
}
public string DoWhatever(IRibbonControl control)
{
}
来源:https://stackoverflow.com/questions/51380155/how-to-create-a-dynamic-submenu-in-contextmenu-for-outlook-vsto