1
votes

I want to add a button for my Isolated shell application to the Main Frame Control pane in Visual Studio 2013. I am not sure the whether pane is called "Main Window Frame Control", but it is the menu where VS 2013 has the Notifications, Quick Launch and Feedback buttons.

How to add a button to that menu with my extension?

enter image description here

1
A screenshot might be nice here.BradleyDotNET

1 Answers

1
votes

The registry key that contains the control registrations is at [ver]_Config\MainWindowFrameControls.

Searching VS's DLLs (using Telerik's JustDecompile, which has mostly functional full-text search) for "MainWindowFrameControls" turns up the FrameControlManager (in the Microsoft.VisualStudio.Shell.UI.Internal assembly and the Microsoft.VisualStudio.PlatformUI namespace). That iterates the registry keys, creating a FrameControl for each populated by calling its Read method. The Read method populates a few properties from the registry key, including its _factoryBundle field. This contains the GUID of the view factory, view ID, and data source IDs as well (read from the registry key) that will be used to create the control.

The FrameControl's FrameworkElement property (which is almost certainly the part that actually gets displayed on the frame) lazily calls UIFactoryHelper.CreateElementAndDataSource(), passing it the _factoryBundle. This eventually calls WindowHelper.CreateUIElement, which hands it off in turn to the IVsUiFactory. Finally, we've reached a (lightly) documented part of VS -- this is part of the public interface.

It turns out that the view GUID of the frame control refers to one of the "UI Providers" registered by a package. (These can also be seen in the registry, under the _Config\UIProviders key.)

So in short, you'll need to implement the IVsUiFactory interface and register it with the IVsRegisterUIFactories service, then expose (with, say, a .pkgdef or more cleanly with a C# custom attribute that does the registry manipulation for you) the corresponding values under a registry key for your control in MainWindowFrameControls. This will let you create a custom WPF framework element that gets placed in the main window frame.

I didn't look into databinding, but apparently that's possible too -- just trace the FrameControl code until you find out how it works (using a good decompiler -- I like a combination of JustDecompile for its full-text search, and dotPeek for its interface).


P.S. Hey, another isolated shell developer! Hi & good luck :-)