WPF 与 Silverlight [英] WPF vs Silverlight

查看:28
本文介绍了WPF 与 Silverlight的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能的重复:
WPF 和 Silverlight 应用程序有什么区别?

WPF 和 Silverlight 之间的确切区别是什么?

What are the exact differences between WPF and Silverlight?

推荐答案

这是一个非常广泛的问题.我的公司最近写了一份白皮书,概述了这两种技术之间的差异,大约有 70 页.不幸的是,它还没有发布,否则我会给你链接.

That's an extremely broad question. My company recently wrote a whitepaper outlining the differences between the two technologies, and it's around 70 pages. Unfortunately, it's not published yet, or I'd give you the link.

正如所承诺的,这是链接Codeplex 上的白皮书:

http://wpfsluidance.codeplex.com/

不过,我会尽量总结一下.

However, I'll try to summarize.

  1. WPF 是一个厚 Windows 客户端平台,可以访问完整的 .Net 框架.Silverlight 是一种基于浏览器的技术,可以访问 .Net Framework(称为 CoreCLR)的子集.因此,您会注意到在框架内使用看似日常的方法和对象的差异.例如,String 类上的 Split() 方法在 Silverlight 中有 3 个覆盖,但在 .Net Framework 中有 6 个.您会看到很多这样的差异.

  1. WPF is a thick Windows client platform that has access to the full .Net Framework. Silverlight is a browser-based technology that has access to a subset of the .Net Framework (called the CoreCLR). So, you'll notice differences using seemingly every day methods and objects within the framework. For instance, the Split() method on the String class has 3 overrides in Silverlight, but 6 in the .Net Framework. You'll see differences like this a lot.

在 WPF 中,所有视觉呈现元素都派生自 Visual 基类.在 Silverlight 中,它们没有;相反,它们源自 Control.然而,这两种技术最终都从层次结构中的 DependencyObject 类派生出来.

Within WPF, all visually rendering elements derive from the Visual base class. Within Silverlight, they do not; instead, they derive from Control. Both technologies, however, eventual derive from the DependencyObject class up the hierarchy.

WPF 目前比 Silverlight 提供或拥有更多的用户控件;尽管通过 Silverlight Toolkit 和即将发布的 Silverlight 3 可以缓解这种差异.

WPF, currently, ships or has available more user controls than Silverlight; though this difference is being mitigated through the Silverlight Toolkit and the upcoming release of Silverlight 3.

WPF 支持 3 种类型的路由事件(直接、冒泡和隧道).Silverlight 仅支持直接和冒泡.

WPF supports 3 types of routed events (direct, bubbling, and tunneling). Silverlight supports direct and bubbling only.

存在相当多的数据绑定差异,在下一个版本的 Silverlight 中会有所缓解.目前,Silverlight 不支持绑定模式、OneWayToSource 或 Explict UpdateSourceTriggers.此外,如果没有设置,Silverlight 默认使用 OneWay 数据绑定,而 WPF 使用依赖属性指定的默认模式.

There's quite a few data-binding differences that will be somewhat mitigated with the next version of Silverlight. Currently, Silverlight doesn't support the binding mode, OneWayToSource, or Explict UpdateSourceTriggers. In addition, Silverlight defaults to OneWay databinding if none is set, while WPF uses the default mode specified by the dependency property.

Silveright 不支持多重绑定.

Silveright doesn't support MultiBinding.

Silverlight 支持 XmlDataProvider 但不支持 ObjectDataProvider.WPF 两者都支持.

Silverlight supports the XmlDataProvider but not the ObjectDataProvider. WPF supports both.

Silverlight 只能进行异步网络调用.WPF 可以访问完整的 .Net 网络堆栈,并且可以进行任何类型的调用.此外,目前,Silverlight 支持 SOAP,但无法在本机处理 SOAP 错误异常(这可能会在 Silverlight 3 中发生变化).

Silverlight can only make asynchronous network calls. WPF has access to the full .Net networking stack and can make any type of call. Also, currently, Silverlight supports SOAP, but can not handle SOAP fault exceptions natively (this may change in Silverlight 3).

密码学存在巨大差异(Silverlight 在命名空间中有 20 个类,而 WPF 可以访问 107 个).基本上,Silverlight 仅支持 4 种散列算法和 AES 加密协议.

There are huge differences in Cryptography (Silverlight has 20 classes in the namespace, while WPF has access to 107). Basically, Silverlight supports only 4 hashing algorithms and the AES encryption protocol.

Silverlight 尚不支持:命令、验证、打印、XPS 文档、语音、3D、可冻结对象或与 Windows 桌面的互操作;所有这些都在 WPF 中可用.

Silverlight doesn't yet support: Commanding, Validation, Printing, XPS Documents, Speech, 3D, Freezable objects, or InterOp with the Windows Desktop; all of which are available in WPF.

Silverlight 支持浏览器互操作、更多媒体流选项,包括时间线标记和深度缩放.WPF 尚不支持这些功能.

Silverlight supports browser interop, more media streaming options including timeline markers, and Deep Zoom. WPF doesn't support these features yet.

这绝不是完整的,因为我试图将 70 页的文档缩减为要点.

This is by no means complete as I was trying to reduce a 70-page document into bullet points.

最后,即使存在所有这些差异,Microsoft 仍在努力缩小这两种技术之间的差距.Silverlight Toolkit 和 WPF Toolkit 都解决了每种技术的一些缺点.Silverlight 3 将添加许多当前不可用的功能(例如元素到元素的数据绑定).但是,由于核心库的不同,总会有一些Framework的差异.

Finally, even with all these differences, Microsoft is trying to close the gap between the two technologies. The Silverlight Toolkit and the WPF Toolkit both address some of the shortcomings of each technology. Silverlight 3 will be adding many features not currently available (such as element-to-element data binding). However, due to the differences in the core libraries, there will always be some Framework differences.

这篇关于WPF 与 Silverlight的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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