Search code examples
c#wpfxamlribbon

How can I hide/disable WPF ribbon tab dynamically?


Let's say I have a ribbon tab name A (name="_tabA") and B (name="_tabB"). How can I disable or hide tab A or B dynamically?

I use VS2010 with RibbonControlsLibrary.dll.


Solution

  • <ribbon:RibbonTab Visibility="{Binding ShowThisRibbonTab, Converter=...}">
    

    Where ShowThisRibbonTab is a property of your ViewModel and the Converter is most likely a BooleanToVisibilityConverter.

    Alternatively, if you're not doing MVVM, you can just give it a name and set the Visibility