7
votes

I made a custom XAML designer as http://code.msdn.microsoft.com/windowsdesktop/Designer-View-Over-XML-20a81f17 I have a question: how to make custom designer worked only on some types of projects (eg custom type of projects), and all the other projects designer used by default.

In file VsTemplateDesignerPackage.cs have:

// Microsoft Visual Basic Project
[EditorFactoryNotifyForProject("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", EditorFactory.Extension, GuidList.guidXmlChooserEditorFactory)]
// Microsoft Visual C# Project
[EditorFactoryNotifyForProject("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", EditorFactory.Extension, GuidList.guidXmlChooserEditorFactory)]

I add:

//CustomProjectType
[EditorFactoryNotifyForProject("{GUID CustomProjectType}", EditorFactory.Extension, GuidList.guidXmlChooserEditorFactory)]

But it does not work. This leads to the fact that the custom designer for this extension is used in all types of projects.

How do I make a custom designer to open *.XAML files only in custom projects?

1
Did you manage to find a solution that works well for you? Cause i'm now in the same boat and have no solution. - Gilad

1 Answers

0
votes

I think there is no standard way of doing that in VSSDK. A designer mainly targets a certain file extension and will be invoked for that file extension in any project type.

I would try to see if there is a way to redirect or deny a request to create/instantiate that editor after inspecting the current loaded project type, or alternatively find out the next-in-line editor for your file type and create an instance of it and return it instead.

unfortunately I'm unable to provide technical details or code as it been years since I last touched any VSSDK code.