Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9252267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:54:09+00:00 2026-06-18T10:54:09+00:00

I am developping a plugin for Visual Studio in C#. The plugin has a

  • 0

I am developping a plugin for Visual Studio in C#. The plugin has a settings page and a few buttons in a toolbar to call commands.

The problem is that in some circonstances, I want to hide a specific button. The best I was able to do is to disable the button.

Is it possible to dynamically change it’s visibility?

EDIT: I wrote this question from my mobile, so maybe there is not enough details…

I create the toolbar in the .vsct file (I created the menu in the same file)

<Button guid="guidProductCmdSet" id="startCommand" priority="0x0100" type="Button">
    <Parent guid="guidProductCmdSet" id="ToolbarGroup1" />
        <Icon guid="Icons" id="startIcon" />
        <Strings>
          <CommandName>startCommand</CommandName>
          <ButtonText>Start</ButtonText>
        </Strings>
</Button>

When the extension initializes, I create the commands:

var mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
if (null != mcs)
{
  _startCommandId = new CommandID(GuidList.guidProducyVSICmdSet, (int)pkgCmdIDList.startCommand);
  var startItem = new MenuCommand(StartProcess, _startCommandId);
  mcs.AddCommand(startItem);
}

After, I am able to disable some buttons from the toolbar like this:

var mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
var mc = mcs.FindCommand(commandId);
if (mc != null)
{
    mc.Enabled = false;
}

I tried mc.Visible = false, but it does nothing.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T10:54:10+00:00Added an answer on June 18, 2026 at 10:54 am

    Apparently, this works…

    var commandBars = ((CommandBars)_dte2.CommandBars);
    if (commandBars == null)
    {
        return;
    }
    var commandBar = commandBars["MyPluginProductName"];
    if (commandBar == null)
    {
        return;
    }
    var startButton = commandBar.Controls["startCommand"];
    if (startButton == null)
    {
        return;
    }
    startButton.Visible = false;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing a DLL (in Visual C# Express) with some plugin logic for
I'm developing some cross platform software targeting Mono under Visual Studio and would like
hi the context is that I am developping a jQuery plugin for a mousehold
I'm developing a grails plugin that is supposed to be a visual front end
I'm developing a plugin that has node(computer) objects with attributes like: String name String
I have created a simple Silverlight Plugin that makes a call to a WCF
I'm developing an AutoCad plugin (MFC dll), I'm using Visual Studio 2010 and C++.
I am developing an plugin for OsiriX . In that app i have 3-4
I am developing a plugin that requires retrieval of path/filename of java files. The
I am developing a plugin that requires retrieval of path/filename of java files. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.