Register custom file type with custom UI editor in Visual Studio 2010 - visual-studio-2010

I found old article called LearnVSXNow and part #30 - Custom Editors in Visual Studio. There is sample project The Blog Item Editor which shows how to make custom file type assigned with custom UI editor for this file type extension (.blit)
This sample uses project VSXtra, which is written for Visual Studio 2008.
Can someone point me to some tutorial, how-to, or something how to do the same for Visual Studio 2010 ? My goal is to register custom file type extension (e.g. *.myext1) within visual studio 2010, and assign my own custom UI designer (WinForms, derived from UserControl) to handle editing content of such file visually.
I found some samples, but each of that shows only changes on code text editor (highlight some words, etc). But i want to show my own toolwindow with my usercontrol within it.
PS: Part of creating custom toolwindow with my own usercontrol within it is not problem, i use VSPackage Builder Project Template to build and register it within visx. My problem is how to register custom file type to use this custom toolwindow to edit file.

While the core text editor changed significantly (nearly a total re-write, designed around MEF) in Visual Studio 2010, the general infrastructure for registering and supplying custom editors/designers did not change.
The 'Creating Custom Text Editors and Designers' page on MSDN is a good place to start. You should also be able to go through the VSPackage wizard and choose "Custom Editor" to get a basic editor in place. It will give you a simple RTF editor.
You can also check out these samples on the MSDN Code Gallery for more ideas and inspiration:
Editor with Toolbox Support
Designer View Over XML Editor
It is usually recommended that editors reside in a document window (as opposed to a tool window). This is the paradigm that nearly all the built-in editors/designers use in Visual Studio, and it's what users expect when opening something from Solution Explorer. Editing things in a ToolWindow can feel a bit unnatural.
My understanding is that VSXtra provides some additional helper/base classes (beyond what Microsoft supports) to make various tasks (like writing a custom editor/designer) simpler. It is by no means required to create a custom editor though.

Related

Is it possible to add VSIX XAML Toolbar to Visual Studio?

Is it possible to add XAML toolbar (instead of native Visual Studio in vsct file) to Visual Studio (in this case Visual Studio Shell)?
I cannot find any examples in the Internet.
I would recommend you stick with using a VSCT resource, to keep your extension consistent with the look and feel of the IDE as a whole.
That being said, there is nothing stopping you from designing a toolwindow or custom designer that hosts XAML based toolbars. Some extenders choose to do this, but the buttons hosted are not VS commands, are not exposed to or discoverable via the Tools | Customize dialog, other extensions cannot automate or programmatically access them, and you lose the built in functionality to control visibility/enablement based on active contextUI guids.
Sincerely,

How do I get access to existing icons from other components from a VS package?

I have a Visual Studio package, and I want to display the VS snippets icon - how can I get it?
I found that I needed to use IGlyphService passing in StandardGlyphGroup.GlyphCSharpExpansion and StandardGlyphItem.GlyphItemPublic. This gets me back the standard "scissors" icon for snippets.
You can get the Visual Studio icons from the Visual Studio Image Library. Simply search for snippet to find the snippet icons (sometimes it is quite hard to find a specific icon).
This icons can be freely used AFAIK. The only restriction is, that the have to be used the way they are intended to be used (don't use a delete icon for a menu item that triggers a create operation etc.)

Override text rendering in Visual Studio?

I want to customize the way the text is rendered in Microsoft's Visual Studio text viewer. The goal is to implement my own complicated algorithm for whitespace handling.
Note: I've already written "add-ins" to automate some tasks (include guards, copyright insertion in the file's header etc...). However, as far as I understand, "add-ins" cannot be used to override the kind of functionality I need.
Is it possible to override the default text rendering? If yes, where do I start?
(Visual studio 2005 is preferred.)
You should look at Visual Studio language services. Try Language Services on MSDN

Where does Visual Studio save code blocks that are dragged on the Toolbox

You can drag and drop code blocks from the Codeeditor to the Toolbox of VisualStudio, but where does Visual Studio save those code blocks.
Are they globally available (for other projects) or only available in the solution/project they are dragged?
Any code blocks that you drag to the Toolbox are stored in your Visual Studio settings file. The default path to that file is under your "My Documents" folder:
..\My Documents\Visual Studio 2010\Settings\CurrentSettings.vssettings
but of course, the exact location can be specified from the Options dialog in Visual Studio.
They are globally available for all projects in the applicable language. For example, if you create a code snippet in a C# project, it will be available for any C# projects that you create. However, it will not be available in a VB.NET project.
Also note that you can rename the individual snippets by right-clicking on them in the Toolbox, and selecting "Rename Item" from the context menu.
But there is a better and much more powerful way to manage code snippets rather than dragging them to your Toolbox. See this article on Sara Ford's blog (a great resource for tips and tricks relating to VS).

Display multiple UserControls with the same name in the Visual Studio WinForms designer toolbox

In my WinForms project I have multiple UserControl-s with the same name ("View"), in diferent namespaces.
If I understand well, the designer hides the controls with the same name as the designed control from the toolbox. So when I'm in design mode on one of the "View"-s I don't see the other ones.
Is there a way to change the name displayed in the toolbox for an UserControl ? I have tried using DisplayNameAttribute or ToolBoxItemAttribute with no succes. Also DescriptionAttribute doesn't see to work either (I was expecting the description to be added to the toolbox item tooltip)
Or is there another way to display multiple UserControl-s with the same name in the Visual Studio WinForms designer toolbox ?
Using Visual Studio 2008
You can do this if you add each control to a different tab in the toolbox (just right-click in the toolbox and select Add Tab. Name each after the namespace.). This is how VS supports having controls with the same names between WinForms and web apps, for example.

Resources