我可以创建使用WPF显示的Visual Studio 2010加载项吗? [英] Can I create a Visual Studio 2010 Add-In that Uses a WPF Display?

查看:97
本文介绍了我可以创建使用WPF显示的Visual Studio 2010加载项吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在为企业应用程序创建专门的图形编辑器。我们查看并拒绝了DSL。理想情况下,我希望将编辑器的主界面像代码窗口一样固定,并使用WPF进行绘制。谁能指出我一些文档,以使我走上正确的道路?



谢谢。



科林。 / p>

更新:它开始看起来像否。从 http://msdn.microsoft.com/en-us/library/bb166228。 aspx :通过实现编辑器来创建文档窗口。IVsEditorFactory接口在实例化编辑器时创建文档窗口。有关更多信息,请参见使用旧版接口访问编辑器。



以下链接指向 http://msdn.microsoft .com / en-us / library / dd885127.aspx 给出了以下建议:您可以从旧界面访问Visual Studio编辑器。VisualStudio SDK包含称为垫片的适配器,这些适配器使这些接口能够与新的编辑器进行交互。尽管如此,我们建议您更新旧代码以使用新的编辑器API。您的代码将性​​能更好,并且可以使用Windows Presentation Foundation(WPF)和Managed Extensibility Framework等新技术。 (MEF)。



因此,总结起来:如果要实现编辑器,则必须使用旧版接口,但不应该使用旧版接口因为这样您就不能使用WPF或MEF。



Microsoft,WTF是吗?



更新2:现在我拥有适当的名称(自定义编辑器),就可以找到以下主题: http://social.msdn.microsoft.com/Forums/en-US/vsxprerelease/thread/9e605d0f-1296-47c9-a534-e54905251ebe



我仍然不明白为什么他们不能将其包含在MSDN文档中的某个显着位置。您知道,就像在附近的某个地方,他们告诉您如果使用旧版接口,则无法使用WPF。

解决方案

创建自定义编辑器不一定非要痛苦。是的,自定义编辑器将需要实现一些接口,但是您仍然可以使用WPF实际创建VS文档框架中托管的控件。



DiveDeeper的博客有





我建议使用类似 VSXtra 做的很多为您工作。它将为您提供编辑器工厂,编辑器窗格,程序包等的良好基础实现。Istvan Novak撰写了有关在此博客文章


We're working on creating a specialized graphical editor for our enterprise applications. We've looked at and rejected DSLs. Ideally I'd like to have the main interface of the editor be docked like the code windows and use WPF for drawing. Can anyone point me to some documentation to get me on the right path?

Thanks.

Colin.

UPDATE: It's beginning to look like "no." From http://msdn.microsoft.com/en-us/library/bb166228.aspx: "Document windows are created by implementing an editor. The IVsEditorFactory interface creates document windows as part of instantiating an editor. For more information, see Accessing the Editor By Using Legacy Interfaces."

Following the link to http://msdn.microsoft.com/en-us/library/dd885127.aspx gives this this bit of advice: "You can access the Visual Studio editor from legacy interfaces. The Visual Studio SDK includes adapters known as shims, which enable these interfaces to interact with the new editor. Nevertheless, we recommend that you update your legacy code to use the new editor API. Your code will perform better and you can use new technologies such as the Windows Presentation Foundation (WPF) and the Managed Extensibility Framework (MEF)."

So, to sum up: if you want to implement an editor you have to use the legacy interfaces, but you shouldn't use the legacy interfaces because then you can't use WPF or MEF.

Seriously Microsoft, WTF?

UPDATE 2: Now that I have the proper names ("custom editor"), I was able to find the following topic: http://social.msdn.microsoft.com/Forums/en-US/vsxprerelease/thread/9e605d0f-1296-47c9-a534-e54905251ebe

I still don't see why they couldn't have included that somewhere prominent in the MSDN docs. You know, like somewhere near where they tell you that you can't use WPF if you're using the legacy interfaces.

解决方案

Creating a custom editor doesn't have to be terribly painful. Yes, a custom editor will require implementing a few interfaces, but you can still use WPF to actually create the control that is hosted in the VS document frame.

DiveDeeper's blog has some great resources for learning about creating a custom editor.

I'd recommend using a library like VSXtra to do a lot of the work for you. It will provide you with a nice base implementation of an editor factory, editor pane, package, etc. Istvan Novak writes about building a custom editor with his VSXtra library in this blog post.

这篇关于我可以创建使用WPF显示的Visual Studio 2010加载项吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆