C# / WPF - 重新编译 SilverLight 4 工具包以在 WPF 应用程序中使用是否可行?
我真的很喜欢 Silverlight 4 中提供的一些预构建控件工具包
我知道 CLR 是不同的,但我希望我可以下载源 和重新编译 WPF 使用的 CLR。
这可能吗?相比之下,WPF 工具包非常基础,并且没有令人鼓舞的评论。
非常感谢。
I really like some of the pre-built controls available in the Silverlight 4 Toolkit
I understand the CLRs are different but I was hoping that I could download the source and recompile for the CLR that WPF uses.
Is this possible? The WPF Toolkit is very basic by comparison and doesn't have encouraging reviews.
Many Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您是否看过扩展 WPF 工具包:http://wpftoolkit.codeplex.com/
Have you looked at the Extended WPF Toolkit: http://wpftoolkit.codeplex.com/
嗯,WPF 和 Silverlight 都使用相同的 CLR 版本(运行时 v2 或 v4)。区别在于这两个框架(库)本身。
理论上是可以的,但是要看具体代码。
这可能会有所帮助:
Well, both WPF and Silverlight uses the same CLR version (runtime v2 or v4). The difference is in these two frameworks (libraries) theirselves.
Theoretically, it's possible, but depends on concrete code.
This might help:
这当然是可能的,但您将无法为 WPF 重新编译。您需要为 WPF 创建全新的项目文件 (csproj) 或手动转换现有项目文件。
此外,您必须以 WPF 4 为目标,因为 Silverlight 工具包大量使用 VisualStateManager。或者,您可以从 WPF 工具包获取 VisualStateManager,并以 WPF 3.5 SP1 为目标。
Silverlight 工具包中将有几个支持类和/或类成员,而 WPF 中不需要这些。例如使用 MouseEnter/MouseLeave 事件模仿 IsMouseOver 属性的控件。这些需要删除并更新才能利用 WPF 版本。
完成所有这些之后,它应该可以针对 WPF 进行编译。不过,由于框架之间的差异,您可能会在运行时遇到一些问题。其中每一个都必须单独解决。
It is certainly possible, but you won't be able to recompile for WPF. You'd need to create brand new project files (csproj) for WPF or convert the existing ones manually.
In addition, you'd have to target WPF 4, since the Silverlight toolkit makes heavy use of the VisualStateManager. Or you could get the VisualStateManager from the WPF toolkit, and target WPF 3.5 SP1.
There are going to be several supporting classes and/or class members in the Silverlight toolkit, which are not needed in WPF. Such as controls that mimic the IsMouseOver property using MouseEnter/MouseLeave events. These would need to be removed and updated to leverage the WPF version.
After doing all that, it should compile for WPF. You may run into some issues during runtime though, due to quirks with differences in the frameworks. Each of these would have to addressed individually.