简体   繁体   English

Silverlight与WPF有什么关系(如果有)?

[英]What is Silverlight's relationship — if any — to WPF?

I was working with a WPF application and I decided that the controls and graphics I wanted to display on the grid might look better if it was a silverlight component. 我当时正在使用WPF应用程序,但我决定要显示在网格上的控件和图形如果是Silverlight组件,可能看起来会更好。

I thought this way because of all the cool silverlight controls that look very flash-like. 我之所以这样想,是因为所有酷炫的Silverlight控件看上去都非常像闪光灯。

But now that I have gottem my Visual Studio 2010 set up with SIlverlight, it seems that every silverlight app I can make are ASP.NET in nature. 但是现在我已经有了使用SIlverlight设置的Visual Studio 2010的系统,似乎我可以制作的每个silverlight应用程序本质上都是ASP.NET。 It seems that instead of a cool GUI control to make, Silverlight is telling me that it is primarely a dataflow sort of application for the web. 似乎不是要制作一个很酷的GUI控件,Silverlight告诉我它主要是一种用于Web的数据流应用程序。

What is the relationship, if any, between WPF and Silverlight. WPF和Silverlight之间是什么关系,如果有的话。 Can I or can I not put a silverlight control into my existing WPF application? 我可以还是不能将Silverlight控件放入现有的WPF应用程序中?

It's my understanding that Silverlight is like "WPF lite", and that in many ways they are almost the same thing but made for different purposes (desktop vs. web). 据我了解,Silverlight就像“ WPF lite”一样,并且在许多方面它们几乎是同一件事,但都是出于不同的目的而制作的(台式机与Web)。 If you want your wpf application to have a different look, you don't need to bring in any other controls from silverlight, because you can simply re-style or re-template them to suit your needs (which you can also do in silverlight). 如果您希望wpf应用程序具有不同的外观,则无需从silverlight引入其他任何控件,因为您可以简单地重新设置样式或重新设置模板以满足您的需求(您也可以在silverlight中进行此操作) )。 But you can't simply use silverlight controls in wpf because they're compiled to run on different runtimes. 但是您不能在wpf中简单地使用silverlight控件,因为它们被编译为在不同的运行时上运行。

Silverlight does have a number of un-official controls in the silverlight toolkit which are not included in wpf or the wpf toolkit. Silverlight在Silverlight工具包中确实有许多非官方的控件,而这些控件并未包含在wpf或wpf工具包中。 They are open source, and if you really want, you could port them to wpf, especially since the code is very similar to wpf. 它们是开源的,如果您确实需要,可以将它们移植到wpf,尤其是因为代码与wpf非常相似。

Silverlight is essentially a subset of WPF that is used to create web-based applications. Silverlight本质上是WPF的子集,用于创建基于Web的应用程序。

You might be able to jump through some hoops to get a limited Silverlight application running in WPF, but I doubt it would be worth it... 您也许可以跳过一些障碍,以使有限的Silverlight应用程序在WPF中运行,但我怀疑这样做是否值得...

I know others may point out that SL is WPF lite. 我知道其他人可能会指出SL是WPF精简版。

But hope you find out they are different frameworks at least right now though they share XAML, and a similar model. 但是希望您至少发现它们共享XAML以及类似的模型,至少现在是它们是不同的框架。

Not sure if in the future they become the same, but keep the differences in mind is critical at this moment. 不确定将来是否会变得一样,但是目前记住差异至关重要。 :) :)

We know DevExpress is now shipping the same code base of their components for WPF and SL, but that does come after putting a lot of efforts. 我们知道DevExpress现在为WPF和SL交付了其组件的相同代码库,但这确实需要付出很多努力。

http://community.devexpress.com/blogs/ctodx/archive/2010/04/20/merging-our-silverlight-and-wpf-ui-controls.aspx http://community.devexpress.com/blogs/ctodx/archive/2010/04/20/merging-our-silverlight-and-wpf-ui-controls.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM