views:

153

answers:

2

How do I create a custom Visual Studio 2008 UI designer for a C# file?

For example, when you double click on a DataSet in the Solution Explorer, a UI screen appears that allows you to edit the DataSet, even though it is defined in XML/code (which you can right click and "View Code").

Usually this code is separated from user code in some way, either by region ("Windows Forms Designer Generated Code"), by codegen (".g.cs" for WPF XAML files), or some other means like partial classes.

+1  A: 

Well, you'd have to buy into the Visual Studio extension model. There are things you can do with the EnvDTE class. They are however fairly limited, not good enough to do what you want to do.

The next stop is the unmanaged extensibility model, based on COM. That requires writing unmanaged COM code, based on IVxxxx interfaces. Available to 3rd party addon developers like the company that makes Resharper. You have to get a license to write that kind of code, Microsoft won't be convinced you won't crash their product until you show some kind of proof you know what you are doing. You'll have to call, I think it is called the VSIP licence. That's possible, obviously it has been done.

Ask your company's legal counsel to take care of those hurdles.

Hans Passant
Thank you, but I think that this may be overkill with newer versions of visual studio. I did find a sample project called StoryBoardDesigner on CodePlex that seems to be a good starting point (and doesn't require involving MS for licensing).
Mick
+1  A: 

For some hints on Visual Studio Extensibility, see "Visual Studio 2010 addin writing articles/tutorials?". The Visual Studio SDK may have the information you need.

John Saunders