Register your own file type with a custom user interface editor in Visual Studio 2010

I found an old article called LearnVSXNow and part # 30 - Custom Editors in Visual Studio . There is an example Blog Element Editor project that shows how to create your own file type assigned by a custom user interface editor for this file type extension (.blit). This example uses the VSXtra project, which was written for Visual Studio 2008 .

Can someone point me to some kind of tutorial, somehow or something, what to do for Visual Studio 2010 ? My goal is to register a file type user extension extension (for example, * .myext1) in visual studio 2010 and designate my own user interface (WinForms, obtained from UserControl) to visually edit the contents of such a file.

I found several samples, but each of them shows only the changes in the text editor of the code (highlight a few words, etc.). But I want to show my own tool with my user control inside it.

PS: The part of creating a custom tool window with my own user control inside it is not a problem, I use the VSPackage Builder Project Template to create and register it inside visx. My problem is how to register a custom file type in order to use this custom file editing tool.

+4
source share
1 answer

Although the main text editor has changed significantly (an almost complete rewrite developed around MEF) in Visual Studio 2010, the overall infrastructure for registering and delivering custom editors / designers has not changed.

The Create Custom Text Editors and Designers page on the MSDN page is a good place to start. You must also go through the VSPackage wizard and select โ€œCustom Editorโ€ to get the basic editor. This will give you a simple RTF editor.

You can also check out these samples in the MSDN Code Gallery for more ideas and inspiration:

It is generally recommended that editors be in the document window (as opposed to the tool window). This is the paradigm that almost all built-in editors / designers use in Visual Studio, and this is what users expect when opening something from Solution Explorer. Editing things in ToolWindow may seem a little unnatural.

I understand that VSXtra provides additional helper / base classes (besides what Microsoft supports) to simplify the execution of various tasks (for example, creating a custom editor / constructor). However, you do not need to create your own editor.

+10
source

Source: https://habr.com/ru/post/1338734/


All Articles