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

  • Home
  • SEARCH
  • 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 3304424
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:03:38+00:00 2026-05-17T21:03:38+00:00

I have been developing a Visual Studio extension as an Add-in for VS2008/2010. The

  • 0

I have been developing a Visual Studio extension as an Add-in for VS2008/2010. The new version now is to be done as a VSIX package for VS2010 only (as it has to be .NET 4 anyway), and I am having some troubles with (rather simple, I would think) UI handling.

The extension primarily consists of a toolbar with some buttons that launch various actions, forms etc., and a few that are only used as labels to display some state information. The “label” buttons themselves just show very short and concise information, while the tooltips provide more detail.

While I didn’t think the whole Add-in thing was very elegant, doing this kind of stuff was pretty straightforward (though my approach may have been a little amateurish). When adding the commands to the toolbar, I would “save” the “label” buttons in specific local variables, allowing me to later set the caption and tooltip text at will.

In a VSPackage, the equivalent to Microsoft.VisualStudio.CommandBars.CommandBarButton appears to be OleMenuCommand. Finding the “label” command through the MenuCommandService is no problem, modifying it as needed is, however.

For the purpose of finding out how to do this, I just have a toolbar with two buttons in a group. btnAction is very simple; just an icon and an execute handler to change the text on the other button, no CommandFlags.
btnLabel looks like this in the .vsct:

<Button guid="guidVSPackageBuilderTutorialCommandSet" id="btnLabel" priority="0x0100">
    <CommandFlag>DefaultDisabled</CommandFlag>
    <CommandFlag>DontCache</CommandFlag>
    <CommandFlag>NoCustomize</CommandFlag>
    <CommandFlag>TextChanges</CommandFlag>
    <CommandFlag>TextOnly</CommandFlag>
    <Strings>
        <CommandName>cmdidbtnLabel</CommandName>
        <ButtonText>btnLabel</ButtonText>
        <MenuText>btnLabel</MenuText>
        <ToolTipText>Tooltip btnLabel</ToolTipText>
    </Strings>
</Button>

The first problem with this is that when I use TextChanges, the ToolTipText string is ignored and the ButtonText is initially used for the tooltip as well.

The handler code for the action button is as follows:

private int iClickCount = 0;

protected override void btnActionExecuteHandler(object sender, EventArgs e)
{
    var svc = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

    CommandID idBtnLabel = new CommandID(GuidList.guidVSPackageBuilderTutorialCmdSet, (int)PkgCmdIDList.btnLabel);
    var cmd = svc.FindCommand(idBtnLabel) as OleMenuCommand;

    cmd.Text = "Clicked " + (++iClickCount) + " times";
}

This changes the caption of btnLabel as expected, but as there is no way of explicitly specifying the tooltip (the OleMenuCommand object just has a Text property, unlike CommandBarButton, which has both Caption and TooltipText), the tooltip is always set to the same string as the caption. From what I understand, this is because with FindCommand() I am not actually getting the UI button, but only the underlying command, which doesn’t care about tooltips.

What’s even more confusing is what happens when I use the TextChangesButton CommandFlag instead of TextChanges. The button will now correctly display the tooltip text defined in the .vsct, but neither the caption nor the tooltip will change when I click the other button – though when I check the btnLabel command’s Text property, it is set to what I expect (“Clicked x times”). Does TextChangesButton kind of “decouple” the properties of the command and the button ? If so, this is pretty much what I want (I don’t care about the command, as there is nothing to execute anyway; btnLabel will always be disabled), but how can I access the button and its particular string properties ?

I looked through the various IVs interfaces and SVs services but couldn’t find something appropriate, and the documentation (and IntelliSense help) doesn’t seem to be very extensive.

  • 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-05-17T21:03:38+00:00Added an answer on May 17, 2026 at 9:03 pm

    To answer this myself – according to someone from the VS team, the new extensibility structure does not offer ways to access these properties of controls in such detail. For what I want to achieve it will be necessary to go the old-fashioned way of getting hold of the DTE object, finding my toolbar and my controls and simply handle them as CommandBarButtons, just as I did in my Add-in.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a classic asp application that I've been developing with Visual Studio 2010
I'm a long-time C++ programmer developing on Windows, and have been using Visual Studio
I'm developing a web application in Visual Studio 2010 on Win 7, and now
Now that Visual Studio 2010 has been officially released has anyone used it for
Currently, I'm developing an extension to Visual Studio 2010 using MEF and I need
I am developing software, alone, in C# using Visual Studio Professional 2010. I have
I have been developing in Android for approximately two months now. Yesterday, my eclipse
So I've been developing on Windows XP Visual Studio 2008. I guess it is
I have a custom sharepoint workflow that I'm developing in Visual Studio. The workflow
I am developing an Windows pplication(using Visual Studio 2008,Sql server 2005). I have to

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.