如何在Outlook的上下文菜单中创建动态子菜单(VSTO)

问题描述:

我有一个功能区xml,我想在其中添加与图片类似的内容.我尝试创建一个按钮并将菜单连接到该按钮,但是我没有得到箭头指示那里存在一个基础菜单.我根本不相信该按钮是要使用的正确元素.现在已经搜寻了几个小时,如果有人可以向我发送指示,我会很高兴.对我来说,在上下文菜单中添加元素没有问题,问题是链接到第一个元素的动态菜单.

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.

您要查找的控件类型是dynamicMenu

The control type you're looking for is dynamicMenu

这是功能区XML:

<dynamicMenu id="mycustomid" label="My custom label" getContent="GetMyCustomContent" />

和代码:

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)
{
}