5
votes

I need to hide the context menu of Ribbon Control

Context Menu Appearing

I tried

<Ribbon.ContextMenu><ContextMenu Visibility="Hidden"></ContextMenu></Ribbon.ContextMenu>

This did the job upto some extent. ie it disables context menu when right clicked on empty space. But when i right click on a ribbon button, still the context menu appears. How can i disable this?

1

1 Answers

10
votes

Ribbon is a ribbon, you should not disable its features. If your "ribbon" really looks like this, consider using toolbars.

That being said, you can disable context menus by setting them to null on all controls on all levels of hierarchy:

<Ribbon ContextMenu="{x:Null}">
    <RibbonTab Header="abc" ContextMenu="{x:Null}">
        <RibbonGroup Header="abc" ContextMenu="{x:Null}">
            <RibbonButton Content="abc" ContextMenu="{x:Null}"/>
        </RibbonGroup>
    </RibbonTab>
</Ribbon>