Adding a Menu Button into VS2010 TFS Query Result or Work Item bar - visual-studio-2010

I am trying to add button(s) to the Visual Studio / TFS2010 Work Item query results menu bar and also to the menu bar shown for individual Work Items (see image below) - is that actually customizable & doable and if so, how?

I would take a look at this post:
TFS 2010 - Adding a menu item to the Completed Builds context menu in the Build Explorer
It discusses the steps you need to take to add menu items to context menus.

To answer my own question (as the one by NGM was helpful but it did not directly answer it.) - no it is not possible as the Work Item & Query Windows inside Visual Studio, particularly their toolbars, are not callable as commands in a VS (SDK) sense.
Basically they are merely WinForms controls (well, were for VS2010, I think this has changed to WPF in VS2013 by now) placed inside a WinForms form hosted inside a VS ToolWindow. The toolbars I outlined above cannot be customised via the VS SDK.
This may have changed in VS2012 or VS2013, but for VS2010 there was/is no way to add custom items into the two toolbars I asked for back then.

Related

Visual Studio 2019 "Solution Explorer" "View Code" icon C#

Does anyone else have this issue? There does not seem to be a way to edit the Solution Explorer toolbar. One of the icons for Solution Explorer is missing in my C# projects.
I am using Version 16.10.3.
I managed to add this icon to the wrong place, but maybe you can find the right place and update this answer.
I did this by customizing menus:
Clicking Tools | Customize...
Selecting Commands tab
Clicking Add Command...
Selecting View
Selecting View Code, and then OK
It looks like what you have to do is find the right place to add it in the first place.
The options under Commands are Menu bar, Toolbar, and Context menu, none of which seems to fit. I looked around briefly; maybe you can do a more in depth search to find the right spot.
I have several extensions installed. One of these modifies the Solution Explorer behavior for dynamic nodes. It's possible that extension or another is interfering with this icon. Try also disabling your extensions and see if that has an effect.
Folks, I figured out the issue. When you create a .NET Core 5.0 project the VS environment is setup different. I deleted the .NET 5.0 project and recreated as a .NET Standard one with the same name and the icon showed up again.
In fact, the Studio 'solution' version is different although your using the exact same VS application. Problem solved for now.

Visual Studio 2019: How to edit menu

In Visual Studio versions prior to VS2019, .NET framework 4.7.2, if you wanted to design a MenuStrip, you just added the MenuStrip to the form and start typing the ToolStripMenuItems. Like this:
I've recently moved to VS2019, and started to use .NET 5. If I add a Menustrip, I get an empty strip, which seems not easy to edit (I colored the background of the main form, to clearly see the white menu strip)
My question is: how to add ToolStripMenuItems?
I see the little arrow on the right, and I can select Edit Items, but to add a menu that way is quite cumbersome.
If I open an old solution in VS2019, I can edit the menu as I used to do. So it's not VS2019.
If I create a new VS2019 project using an old .NET version, I can't edit the menu, so it's not the .NET version
If I copy paste InitializeComponents from an old project to a new .NET 5.0 VS209 solution I cannot edit the menu
So, how to edit the menu? Is edit items really the proper method to edit your menus from now on?
I believe that the MenuStrip editor experience difference comes down to .NET Core vs .NET Framework.
Edit: .NET 5 = .NET Core vNext
We covered MenuStrips while we were doing WinForms in my C# class and this exact question came up. .NET Framework solutions allow you to use the convenient editor as you have demonstrated. .NET Core solutions do not.
The easiest way I found to build out my MenuStrip items when in .NET Core was to click on the menu strip, then there is a property called "Items" which is a collection. In the properties pane, you can click the three dots button to bring up the Items Collection Editor:
Here you can create new ToolStripMenuItem objects to build your menu.
Possibly related post, others suggesting this is a Core vs Framework issue: MenuStrip not allowing to create menu
This issue has been fixed
in Visual Studio latest release v16.10: 05/25/2021 (https://learn.microsoft.com/en-us/visualstudio/releases/2019/release-notes). I have tested this both in net 5 (current) and net core 3.1 (LTS).
Demo:
https://youtu.be/3s55hWrHx4U
You might have used the option that says "Windows Forms App."
This is wrong. You should use "Windows Forms App(.NET Framework)." This will let you edit the menuStrip control the easy way.

Filtering the Visual Studio toolbox

Does anyone know if it is possible at all to filter the Toolbox's items in Visual Studio using an add-in?
Visual Studio 2010 introduced the ability to search but I want to filter, for example: type in button and it must show all items containing "button", same as on this on this Delphi XE screenshot:
This is a very good answer for this question. I copied from the VS blog:
In VS 2010 Beta2, we’ve added the ability to search for controls in the toolbox by name. To use it, put focus in the toolbox (by clicking in it, for example) and start typing the name of the control you want to find. As you type, the selection will move to the next item that matches what you've typed so far.
http://blogs.msdn.com/b/visualstudio/archive/2009/10/26/toolbox-search.aspx
This is something not possible as microsoft does not reveal the secret of adding toolbox controls details completely. They make change the process for each platform and for each versions of visual studio. if we have a clear details of how they add, we can also do the similar kind of small application with search capability and add it as add-in.
Luckily Visual Studio 2012 now has that feature!

Extending VisualStudio

I want to extend Visual Studio such that, when someone right clicks on Solution Explorer, context menu should have a new menu item, say "Open custom form", clicking which should open a form (this form would actually accept some settings and modify config file accordingly)
Q1. Please provide on where should I start for such extension. Couldn't find any reference/tutorial link :(
Q2. What technology can be used to make such a form - Winforms/WPF?
Either Windows Forms or WPF should be fine.
SO: Visual Studio Add-In - adding a context menu item to solution-explorer
Google Code: explorer-popup-add-in
There's a lot of docs on Visual Studio integration here

How can i add an icon to a submenu in a VS2010 add-in?

I can add an icon to a menu item by adding an <icon> to the <button> element in the in the *.vsct file of my Visual Studio Package.
Unfortunately the <icon>issn't available available in a <menu> element.
How can i add an icon to a submenu?
It is possible to do this from code (preferibly C#)?
Maybe via injecting something into the COM / OLE layer?
TortoiseSVN has a icon in the explorer popup menu, have you ever seen a VS plugin that does this?
Unfortunately this isn't possible using VS menus (not with vsct, C#, etc), and they're not very extensible in this regard. However, depending on what you're trying to do, (e.g. if you're looking to do this in a context menu within a tool window rather than the VS menu bar), you may be able to use WPF context menus which should give you the control you need.
I am not sure TortoiseSVN explorer context menu and what you are trying to do in Visual Studio extension are same. As I understand, VSCT Menu element cannot have Icon. Only Button element supports icons. You can check this blog post from DiveDeeper for more information.

Resources