How to create a navigation button for display a plugin

I know how to create a navigation and program a plugin, but I don’t know how to bind the button of navigation and the plugin, I want to realize a click event to display a plugin or not.

Use ActionItem AttachTo property in the ActionItem constructor. For example

[Export(typeof(IPlugin))]
[Export(typeof(IActionItem))]
public class Class1 : ActionItem, IPlugin
{
public Class1() : base(“actionItemid”, “action item command”, “rCommand”, null, MenuTools.ButtonTool, false, true)
{
AttachTo = “[Shortcut Control + F2] = [Action Execute]; [Event Click] = [Action Execute]”;
}

}

 

I build a tab and a plugin.

When I open VC, the plugin always open. I want to stop the opening of the plugin and open by clicking the button.

I have solved this question by setting IsVisible false in IPlugin, it also works in IActionItem.

However, if I don’t set false in IPlugin, it can’t be changed in IActionItem, may be it is a problem.

found.

IoC.Get<IRibbonViewModel>().RibbonTabSelected;

It occurs a bug:

When I first switch RibbonTab to third and fourth, it can’t change the dock visibility even if it excute the code. Only works after.

you can see that its property named “IsVisible” is false, but it displays. And it just works in the first time.