[翻译]  Custom XAML designer in custom projects type Visual Studio

[CHINESE]  自定义项目中的自定义XAML设计器类型为Visual Studio


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.

我做了一个自定义的XAML设计师http://code.msdn.microsoft.com/windowsdesktop/Designer-View-Over-XML-20a81f17我有一个问题:如何使自定义设计师只在某些类型的项目上工作(例如自定义项目类型),以及默认使用的所有其他项目设计者。

In file VsTemplateDesignerPackage.cs have:

在文件VsTemplateDesignerPackage.cs中有:

// 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?

如何使自定义设计器仅在自定义项目中打开* .XAML文件?

1 个解决方案

#1


0  

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.

我认为在VSSDK中没有标准的方法。设计器主要针对某个文件扩展名,并将在任何项目类型中为该文件扩展名调用。

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.

遗憾的是,自从我上次触及任何VSSDK代码以来,我无法提供技术细节或代码。


注意!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。



 
© 2014-2018 ITdaan.com 粤ICP备14056181号