Sliverlight 整理文档
Silverlight探秘系列课程 Silverlight调试、错误处理和异常
Silverlight 系列课程39讲 Silverlight 调试、错误处理和 调试 错误处理和 异常苏鹏 MVP MSDN 特约讲师下载Webcast好帮手iR iReaper文件大小<=2.5Mb 可按照多种分类方式进行批量下载WMV、MP3、MP4、Zune四种格式Webcast访问iReaper主页: /iReaper h d l i加速企业解决方案部署尽在资源和利益• 用于解决方案开发的集中资源 用于解决方案开发的集中资源:资源包括指向测试工具、开发 资源包括指向测试工具 开发 人员 SDK、技术论坛、联机培训等的链接,微软全球技术支持中 心( (GTSC) )的邮件技术支持。
• 对市场调查的访问权限:您可以使用这些宝贵信息来识别您当 前的客户或未来客户的特定需求。
• 认证徽标计划:该徽标可以向客户证明您所具有的优秀技术。
• 市场营销和销售支持 h OMetro – ISV领航计划最先应用微软最新技术 提升ISV 提升 ISV竞争优势和商业价值 竞争优势和商业价值• Metro 提供了结构化的支持来帮助ISV进行新技术的评估和 部署 部署: Discover – 参与前沿技术培训 – 评估最新的微软技术及产品 Release Learn – 获取微软Beta版产品的技术支持 – 联络全球开发人员和架构师社区 – 与世界级的商务和技术社区分享最先 Develop 部署的经验点击添加MSN机器人小新 为您收听下载MSDN中文网络广播课程加油助力!收听本次课程需具备的条件• 了解 解SilverLight应用基础 应 础 • 了解.NET NET 的错误处理基本原理Level 200内容介绍• • • • 调试概括 试 括 错误处理 处理和引发异常 总结Level 300调试概述• 讨论 Silverlight Tools for Visual Studio 2008 可帮 调试 Silverlight g 的应 的应用程 程 ,它可帮助您调试基于 序。
Silverlight常见基本问题.doc
1.调试WCF相关问题的一般步骤是什么?2.如何使得Silverlight和HTML元素之间进行交互?2.1. 如何从JavaScript调用中可脚本化的方法?2.2. 如何从代码后置调用客户端JavaScript函数?2.3. 如何从代码后置访问HTML元素?3.如何在Visual Studio中调试带有Silverlight 功能的网站中的JavaScript代码?4.如何处理 Out-Of-Browser 相关问题?4.1. 如何检测应用程序是否工作在OOB( Out-Of-Browser)模式?4.2. 如何检测OOB更新?4.3. 如何将HTML元素融入Silverlight应用程序?4.4. OOB模式下如何调用JavaScript访问HTML 元素?4.5. 在Silverlight中如何访问cookie?5.如何调试OOB应用程序?6.在OOB模式下如何得到网络状况?7. 如何将XAML转换为图像?8. 如何使用Perspective 3D?9. 何时并如何使用Isolate Storage?10. 如何使同一页面的2个Silverlight应用程序交互?11. 如何指定安装界面?12. 什么是Element Binding?13. 什么是Binary Xml?14. Silverlight应用程序如何相互交互?15. Silverlight中如何访问本地字体?16. 什么是 Silverlight 导航应用程序(Navigation Application)?========================================== =====================1.调试WCF相关问题的一般步骤是什么?默认情况下,Silverlight使用浏览器HTTP栈。
这种情况下,如果WCF发生了一个错误,它会发送HTTP 404响应码,错误详细信息并不能在Silverlight客户端中被访问到。
Silverlight学习笔记1
简单了解 Silverlight 平台
在开始了解 Silverlight 平台前,请看看先前章节中提到的 xap 包.你可以将 Hello word application(也许你完成了,如果没有你可以建立一个新的,直接编译就可以了)项目中位于 ClientBin 文件夹下的 HelloWorld.xap 复制到任何一个地方,将其后缀名由 xap 改成 zip.然 后用工具打开看看所谓的程序包里到底装了写什么东西. 如果你做的程序足够简单你会看到两个 文件 AppManifest.xaml 和 HelloWorld.dll 文件,这些文件会被下载到客户端,然后被客户端 runtime 运行. 这里经历了几个步骤:
SilverLight_SEO
作者:Ashish Shetty 基于Silverlight应用程序的搜索引擎优化(SEO. Search Engine Optimization) 2009年7月29日70摘要本文档介绍了一些基于Silverlight应用程序进行搜索引擎优化的技巧。
这些技巧可以帮助开发人员,使他们编写的Silverlight内容更容易在搜索引擎的结果页中得到显示,并为不能安装及使用Silverlight应用的用户提供了一些恰当的体验方式。
这份文档将包括以下章节:∙介绍∙搜索引擎的工作原理∙开发Silverlight应用的方式∙Silverlight应用程序的搜索引擎优化技术∙结语介绍搜索引擎一般是专门针对HTML内容来抓取信息的。
因此,搜索引擎并不能自然的识别Silverlight的内容。
这与搜索引擎不能识别某些通过HTML页面呈现的对象的现象很类似,这些对象包括脚本(script blocks)、样式表(CSS blocks)、媒体文件和ActiveX控件。
你可以使用一些搜索引擎目前已经支持的方法来为Silverlight应用程序的内容建立索引,例如可以将孤立的Silverlight信息同与其内容相关的HTML元数据(Metadata)相结合。
.SEO的目的就是为了增加页面在搜索引擎的主要结果页(图中被红色矩形框标注的部分)中的显示机会,而不是为了显示在广告位或是赞助商的结果页。
.图 1 –搜索引擎主要结果页因为不断加入的竞争者的改进与革新,搜索引擎技术的前景正发生着迅速的变化,但是,在进行SEO时,所依赖的搜索引擎算法中的一些基本原理是很相似的。
搜索引擎工作原理搜索引擎可以对Web页面的内容进行抓取、评估与建立索引。
抓取的过程由搜索引擎网际爬虫(robot)来实现,他们沿着网站的链接捕获网页内容。
搜索引擎使用一些算法来评估WEB页面的价值。
在这些过程中产生的信息被用于建立索引, 也就是建立一个符合用户查询条件的结果页。
(2021年整理)SilverLight学习笔记--Silverligh之动态加载程序集(.DLL)
(完整版)SilverLight学习笔记--Silverligh之动态加载程序集(.DLL) 编辑整理:尊敬的读者朋友们:这里是精品文档编辑中心,本文档内容是由我和我的同事精心编辑整理后发布的,发布之前我们对文中内容进行仔细校对,但是难免会有疏漏的地方,但是任然希望((完整版)SilverLight学习笔记--Silverligh之动态加载程序集(.DLL))的内容能够给您的工作和学习带来便利。
同时也真诚的希望收到您的建议和反馈,这将是我们进步的源泉,前进的动力。
本文可编辑可修改,如果觉得对您有帮助请收藏以便随时查阅,最后祝您生活愉快业绩进步,以下为(完整版)SilverLight学习笔记--Silverligh之动态加载程序集(.DLL)的全部内容。
(完整版)SilverLight学习笔记-—Silverligh之动态加载程序集(。
DLL)编辑整理:张嬗雒老师尊敬的读者朋友们:这里是精品文档编辑中心,本文档内容是由我和我的同事精心编辑整理后发布到文库,发布之前我们对文中内容进行仔细校对,但是难免会有疏漏的地方,但是我们任然希望(完整版)SilverLight学习笔记-—Silverligh之动态加载程序集(.DLL) 这篇文档能够给您的工作和学习带来便利。
同时我们也真诚的希望收到您的建议和反馈到下面的留言区,这将是我们进步的源泉,前进的动力。
本文可编辑可修改,如果觉得对您有帮助请下载收藏以便随时查阅,最后祝您生活愉快业绩进步,以下为 <(完整版)SilverLight学习笔记--Silverligh之动态加载程序集(。
DLL)〉这篇文档的全部内容.自定义TextEventArgs 事件参数类定义一个接口IEditUI}1。
2、定义用户编辑器类用与定义接口同样的方法,我们添加一个Silverlight类库项目,命名为:Implementation.新建后,解决方案如下图:在编写Implementation类的代码前,我们需要添加引用前面所定义的Interfaces接口,引用界面如图:using System;using ;using System.Windows;using System.Windows.Controls;using System.Windows。
SilverLight文档
SilverLight 文档安装步骤 Silverlight4 版本1:安装 Silverlight Runtime (即 SilverLight 运行时)2:安装 Silverlight_SDK.exe3 : 安装 Silverlight_Developer.exe4 : 安装 Silverlight4_tools.exe5 : 安装RiaServices.msi安装Microsoft Expression Blend 41 : 安装BlendWPFSDK_zh-Hans.msi2 : 安装ExpressionStudio_UltimateTrial_zh-Hans.exe 中的 Blend 4安装步骤 Silverlight5 版本1:安装 Silverlight Runtime (即 SilverLight 运行时)2:安装 Silverlight_SDK.exe3 : 安装 Silverlight_Developer.exe4 : 安装 Silverlight5_tools.exe5 : 安装RiaServices.msi()必备条件1 : Linq2 : WPFSilverlight 动画VSM 视觉状态管理器自制控件。
OOB特性– Out Of Browser MVVM架构 -效果图新建SilverLight 项目确定后,然后在 Blend 4 打开新建项目在上面修改设计空间的样式,也可以加载动画效果。
修改好后保存,然后VS2010就会提示是否加载更新。
项目选项卡属性页可以调整空间的布局外观样式等功能。
资产选项卡可以添加控件、给控件及自制图形赋予行为,出现动画效果。
对象和时间线它可以控制所在时间当前的状态。
事例一:1:在”数据”选项卡新增示例数据,,之后在property2里面选择图片类型,并指定图片路径。
,在Collection里选择要显示的图片,及更改显示的名称。
,把 Collection 拖拽到页面上,如图。
Silverlight论文翻译
毕业设计(论文)外文资料翻译附件1:外文资料翻译译文1.Silverlight 和Flash比较目前最成功的浏览器插件之一是ADOBE的Flash,已经被安装在超过 90% 的浏览器上面。
Flash拥有跨越长达十年的发展历史,开始作为一个图形动画,并逐步加入到不同的开发平台,不断发展的互动内容简单的工具。
当然.NET开发人员创建的网站使用Flash插件是完全合理的。
可是,这样做需要一个独立的设计工具,以及一个完全不同的编程语言(ActionScript)和编程环境(Flex)。
但是,有没有简单的方法来集成Flash内容与服务器端的.NET 代码?例如,通过调用.NET组件创建Flash应用程序是在最好的办法。
使用服务器端的.NET代码,以显示Flash内容(例如自定义一个控件,显示出来的Flash内容)却要困难得多。
Silverlight出现的目的是让.NET开发人员用于创建丰富的网站内容提供更好的选择。
Silverlight提供一个和Flash与许多类似的功能浏览器插件,但是她是一个从根本上针对.NET的环境设计的。
Silverlight的可以非常好的支持C#语言和.NET所涵盖的范围的概念。
因此,开发人员可以编写在相同的语言,他们的服务器端代码(使用如C#的Silverlight客户端代码和VB),并使用相同的抽象很多(包括流,控制,集合,泛型,以及LINQ的)。
Silverlight插件中有令人印象深刻的功能列表,其中有些功能是和Flash 相似,但是少数功能是全新的,甚至是革命性的。
以下是一些要点:二维绘图:Silverlight提供了丰富的二维图纸模型。
最出色的是,你画的内容是指形状和路径,这样你就可以操纵这个客户端上的内容。
你甚至可以响应事件(如对一个鼠标点击的图形部分),这使得Silverlight把互动性变得更加容易。
控制:开发人员不想重新做重复的事情,因此Silverlight是储存了几个要点,包括按钮,文本框,列表,甚至一个DataGrid。
Silverlight入门基础
Silverlight入门教程--基于运行环境示例郑健2008-3-9(一).概述 (3)(二). 代码示例 (3)1).基础知识示例 (3)1. 对象的定位 (3)2. 使用SilverLight插件 (8)3. SilverLight元素的鼠标事件 (10)4. SilverLight元素的键盘事件 (16)5.方法createFromXaml使用示例 (17)6.访问和修改Silverlight元素以及属性 (19)7. Silverlight中的字体使用 (21)8.全屏支持功能 (24)9. Silverlight Downloader 对象使用 (26)10.定时器功能 (29)11.错误处理支持 (31)12.把xaml段内置在aspx或html页面中 (34)2).制作图形示例 (36)13.基本图形形状示例 (36)14.画刷对象的使用 (38)15.视频刷对象的使用 (41)16.Path元素使用 (43)17.变换效果(Transform) (44)3).多媒体功能 (46)18.在线电影播放 (46)4).制作动画效果示例 (51)19.一个动画示例 (51)20.动画的交互控制 (53)21.动画关键帧示例 (55)(一).概述Silverlight是一个跨浏览器的、跨操作系统平台的插件,为Web带来下一代媒体体验和丰富的交互式应用程序体验. 使用JS实现Ajax技术可以使网站具有很好的用户体验, 但它也会使网站过于庞大和臃肿. 业余时间学习了一下微软的Silverlight官方教程, 在学习时顺便根据学习示例整理了一个教程. 此教程包括一些精简的小例子, 主要针对开发使用场景展开示例, 在实际开发中也可以作为查找手册使用. 运行环境为VS 2005, 这些示例比较简单很容易看懂, 因此示例没有太多注释.(二). 代码示例1).基础知识示例1. 对象的定位通过呈现几个Silverlight元素来示例对象之间的定位, 以及在一个页面中创建装载多个Silverlight对象.2. 使用SilverLight插件3. SilverLight元素的鼠标事件I.鼠标滑入和滑出事件II.鼠标点击(按下/弹起)和移动事件4. SilverLight元素的键盘事件5.方法createFromXaml使用示例6.访问和修改Silverlight元素以及属性7. Silverlight中的字体使用8.全屏支持功能9. Silverlight Downloader 对象使用10.定时器功能11.错误处理支持12.把xaml段内置在aspx或html页面中这样的话就不用单独的 *.xaml 文件来承载SilverLight对象控件元素内容.2).制作图形示例13.基本图形形状示例14.画刷对象的使用15.视频刷对象的使用16.Path元素使用17.变换效果(Transform)3).多媒体功能18.在线电影播放。
Silverlight研究报告
编绎后系统自动生成的 Silverlight插件。
Silverlight项目及元素说明 Silverlight项目及元素说明
html中如何调用Silverlight
Silverlight版本号 Silverlight插件路径 Silverlight出错处理
③
Silverlight播放插件下载路径
Silverlight项目及元素说明 Silverlight项目及元素说明
认识XAML
⑤
XAML是eXtensible Application Markup Language的英文缩写,相应的中文名称为可扩展应用程序标记语言,它是微 软公司为构建应用程序用户界面而创建的一种新的描述性语言。XAML提供了一种便于扩展和定位的语法来定义和程 序逻辑分离的用户界面,而这种实现方式和中的"代码后置"模型非常类似。也就是说在开发一个应用程序时, 我们可以将开发工作分成开发人员和设计人员两个团体分别进行,各自负责后台程序代码逻辑和前台程序界面的设计, 这样就使得开发人员和设计人员之间的协作更通畅,也极大地发挥了他们的专长。 常用的XAML设置工具有Expression Blend.我们在Silverlight开发过程中,通常在XAML中声明对象、为元素设置属性 等。)
驱动语言
JavaScript
Javascript ,C#,VB .NET
Silverlight开发环境搭建 Silverlight开发环境搭建
建立Silrlight开发环境分以下四个步骤: Silverlight开发环境分以下四个步骤
1. 首先需要安装开发工具,对于Silverlight 3项目开发,必须使用 Visual Studio 2008 SP1 或者 Visual Web Developer Express with SP1 作为开发工具。在安装过程中,.Net Framework 3.5 sp1同时被安装, 如果没有安装.Net Framework 3.5 sp1需要独立下载安装。 安装开发工具后,需要下载安装Silverlight工具开发包. 点击下载: Silverlight Tools for Visual Studio 2008 SP1, 完成Silverlight开发包安装后,Visual Studio 2008中将自动更新添加Silverlight项目 开发模板,以及Silverlight SDK和相关开发环境. 针对Silverlight 3项目,用户界面设计人员来讲,还需要安装Microsoft Expression Blend 3 . Blend是 Expression配套软件,可以让界面设计人员很轻松的开发出专业的Silverlight用户界面. 最后,需要下载Silverlight Toolkit. 该控件是微软开发的Silverlight控件扩展包.
SilverLight教程2
这是8个系列教程的第2部分,这个系列示范如何使用 Silverlight 2 的 Beta1 版本来创建一个简单的 Digg 客户端应用。
这些教程请依次阅读,将有助于您理解 Silverlight 的一些核心编程概念。
理解布局管理Silverlight 和 WPF 都支持一种灵活的布局管理系统,能让开发者和设计师轻松的定位 UI 上的控件。
该布局系统对显式指定坐标的控件支持固定的定位模型;除此之外,还支持一种更为动态的定位模型,控件和布局能随着浏览器的大小改变而自动改变其大小和方位。
在 Silverlight 和 WPF 中,开发者可以用布局面板来协调包含在其中的控件的位置和大小。
Silverlight Beta1 中内建的布局面板包括在 WPF 中最常用的3种:∙Canvas∙StackPanel∙GridCanvas面板Canvas 面板是一种很基础的布局面板,它支持对其中的控件采用绝对坐标定位。
你可以通过一种 XAML 特性--- "附加属性” 对 Canvas 中的元素进行定位。
用附加属性,你可以指定控件相对于其直接父 Canvas 控件的上、下、左、右坐标的位置。
附加属性很有用,因为它让父面板可以扩展其中包含的控件的属性集。
Canvas 通过定义扩展属性 Top 和Left, 就能定义其中 Button (或其他任何 UI 元素)的 Left, Top,而不需要真正向Button 类中添加这个属性,或修改 Button 类。
我们可以向 Canvas 容器中添加两个按钮,指定其距离 Canvas 左侧的距离为 50 像素,离上边的距离则分别为50 像素和150 像素。
使用如下XAML 语法即可完成(其中Canvas.Top 和 Canvas.Left 都是附加属性的例子):这些代码绘制的界面效果如下:Canvas 适用于其中包含的 UI 元素比较固定的情形,但是如果你想向其中添加更多的控件,或者 UI 需要改变大小或能够移动,Canvas 显得不太灵活。
SliverLight银光点亮世界(理论)
Web 2.0 NTC Spring
Linux/Weblogic J2EE PRT J2EE PMP
LAMP Enterprise Develop .NET PMP
课程目标
学习内容
了解Silverlight技术的优势及开发环境 使用XAML开发用户控件 绘制简单的矢量图和几何图形 Silverlight通过WCF、WebService进行通信 Silverlight使用Socket通信 编写Form/To/By动画 编写制作关键帧动画 Silverlight中应用多媒体 Silverlight与浏览器交互 开发Deep Zoom应用 开发图表和墨迹标注应用
this.Application_UnhandledException; InitializeComponent(); }
初始化应用程序
3.2 应用程序的结构
Silverlight应用程序的结构
Page.xaml:
所有的用户控件都是 同样的根元素 指定后台类文件
<UserControl x:Class="HelloWorld.Page" xmlns="/winfx/2006/xaml/presentation" xmlns:x="/winfx/2006/xaml" Width="400" Height="300"> <Grid x:Name="LayoutRoot" Background="#3c3c3c"> <TextBlock 该命名空间下包含 FontSize="30" WPF常用元素和属性 一个Silverlight应用程序最终被编译为.xap文件,该文件包含程序一个清单 Foreground="Red" Name="tb1" 文件和一个程序集 HorizontalAlignment="Center" 元素(控件)及其属 VerticalAlignment="Center" 性声明 Text="Hello World!" MouseLeftButtonDown="TextBlock_MouseLeftButtonDown"> </TextBlock> </Grid> </UserControl>
Silverlight技术简介及发展
微软silverlight技术介绍目录这篇文章的内容●目录●概述●什么是silverlight定义支持平台丰富的交互式应用程序富客户端应用技术统计为什么选择silverlightSilverlight VS. flashSilverlight VS. WCF丰富VS 达到功能展示深度缩放技术●Silverlight内核Silverlight 和XAML(Extensible Application Markup Language,扩展应用程序标记语言)部署过程Silverlight架构●Silverlight 5●开发工具和坏境Microsoft visual studio 2010Microsoft expression studio 4●Silverlight展望●总结概述这篇文章将要给出微软公司silverlight技术的简单介绍,看看它到底是如何和当今的其他技术相融合的,到底能起到什么作用。
让我们开始吧!什么是silverlight定义Silverlight是微软公司一种致力于帮助开发者创建丰富的web交互应用程序从而使用户得到良好体验效果的技术。
Silverlight作为一个有效的插件程序,使他支持当下的大多数主流浏览器。
他被用来开发下一代媒体应用和web应用。
(图1 siverlight商标)当我们说丰富的应用程序的时候,我们并不是指那些有惊人的接口和很多的图片。
事实上,我们指的是那些很多的标准的web应用程序所不具备的功能。
常见的富交互应用程序是在线文件编辑和图像处理。
他们交互性都非常的强,并且提供了许多标准的web应用程序所不能万层的功能。
实质上那才是Silverlight技术的主要目的所在,它的主要目标就是在web上交互性强的应用程序。
支持的平台并不像微软公司的其他技术一样,Silverlight应用程序可以运行在任何地方。
据说这项技术是跨平台,跨浏览器,跨设备的。
Silverlight可以跑在Windows,Linux,甚至是苹果操作系统上;Silverlight可以跑在IE浏览器,火狐浏览器,谷歌浏览器还有其他主流的浏览器上;Silverlight可以跑在PC机上,手机上,还有其他装置上。
microsoftsilverlight
microsoftsilverlight折叠编辑本段不同版本折叠 S1Silverlight 1.0 由许多核心展示层架构组成,这关系到使用者界面(UI),使用者输入(user input),基本使用者界面控制元件(basic UI controls),图形(graphics)和动画(animation)、媒体播放(media playback),数位权管理(DRM)的支援,以及DOM的整合。
其组Silverlight相关技术图片件如下:(1)输入(Input)- handling input from devices like keyboard,mouse,stylus etc.(2)使用者界面核心(UIcore)- managingrendering of bitmap images(including compressed raster images like JPEG),vector graphics,text and animations.(3)媒体(Media)- playback of MP3,Windows Media and VC-1 streams.(4)XAML - to allow the UI layout to be created using XAML markup language.折叠 S22008年10月13日,微软推出了Silverlight 2.0的RTW版,并提供了相应程式及档案的下载安装。
Silverlight 2.0支援下列新功能特色,弥补了Silverlight 1.0所欠缺的功能:(1)具备一个.NET Framework缩小版的基础类别函式库。
(2)大量内建的Silverlight控制项:在Silverlight 1.0时,所有UI物件都必须透过XAML来自行描述绘制,并缺乏许多内建的Silverlight向量控制项,针对这点,Silverlight 2.0强化控制项方面的能力,内建许多向量控制项供开发人员直接使用。
silverlight 文档
微软Silverlight是一个跨浏览器、跨客户平台的技术,能够设计、开发和发布有多媒体体验与富交互(RIA,Rich Interface Application)的网络交互程序。
因为Silverlight提供了一个强大的平台,能够开发出具有专业图形、音频和视频的Web应用程序,增强了用户体验,所以SilverLight吸引了设计人员和开发人员的眼球。
同时,Silverlight还提供了强大的工具来提高他们的工作效率。
Silverlight能创建一种具有很高艺术性的应用程序,具有以下的特点:◆一种跨浏览器、跨平台的技术。
可以在所有流行的浏览器中运行,包括Micro soft Internet Explorer、Mozilla Firefox, Apple Safari, 和Opera,同样可以运行于Microsoft Windows和Apple Mac OS X。
◆无论在哪运行,都能提供一致的用户体验。
◆需要下载很小的文件来安装以支持,只需几秒。
◆它的视频和音频流,视频质量无论从移动设备还是桌面浏览器都是720p HDT V video模式。
◆用户可在浏览器中直接对其进行控制,可以拖动、翻转、放大的图片。
◆它读取数据并且更新外观,但不会通过刷新整体页面来打断用户操作。
Silverlight将多种技术结合到一个开发平台,可以在其中选择符合需求的合适的工具和编程语言。
SilverLight提供了如下的特性:◆WPF和XAML。
Silverlight包含了Windows Presentation Foundation(WPF)技术,这个技术在创建用户界面时极大的扩展了浏览器元素。
WPF可以创建融合图形、动画、媒体和其他的富客户端特性,扩展了基于浏览器的用户界面,超越了HT ML所提供的。
可扩展应用程序标记语言(XAML)提供了创建WPF元素的声明性标记。
◆对于JavaScript的扩展。
Silverlight提供了对于全球浏览器脚本语言的扩展,从而为浏览器用户界面提供更加强大的控件,包括与WPF元素工作的能力。
Silverlight4 最新资料(1)
Silverlight 4 Overview Technical Feature OverviewContentsCredits (6)Introduction (7)Enabling Business Application Development (8)Printing (8)Localization with Bi-Directional and Script-Based Text and Right-to-Left Support (8)Extended Language Support (9)RichTextBox Control (9)Text Input (11)Viewbox Control (11)Auto-Sizing Columns and Copy from DataGrid (12)Navigation Page Loading Extensibility (13)Command Property on ButtonBase and Hyperlink (13)SelectedValue and SelectedValuePath on the Selector (13)Support for Referer Header (15)UDP Multicast Client Support (15)Networking Enhancements (15)WCF TCP-based Binding (15)WCF PollingDuplex Improvements (16)Authentication Support with ClientHttpWebRequest (16)IDataErrorInfo (16)INotifyDataErrorInfo (19)Grouping on CollectionViewSource (20)Editable CollectionView IEditableCollectionView (20)Binding to String Indexers (20)TargetNullValue (21)StringFormat (21)FallbackValue (22)Databinding Support for Dependency Objects (22)XPath Support for XML (23)ObservableCollection<T>Constructor Accepts IList and IEnumerable (23)Isolated Storage Enhancements (23)Managed Extensibility Framework (MEF) (23)SDK Enhancements (25)Silverlight Toolkit (25)BusyIndicator (25)ContextMenu (27)Microsoft Silverlight 4 Tools for Visual Studio 2010 (27)WCF RIA Services Support (28)Automatic Layout (29)Enhanced Property Editing (30)Styling and Resources (31)WCF RIA Services (33)Overview of WCF RIA Services in Silverlight 4 (33)Key Problems Solved (33)Key Classes: DomainService and DomainContext (33)DomainService Operations (34)Endpoints (34)DomainContext Generation (34)Authentication and Authorization (35)Validation and MetaData (35)DomainDataSource (35)WCF RIA Services Toolkit (35)Performance and Reliability (35)Notes (36)Empowering Richer Experiences (37)Hardware Accelerated PlaneProjection (37)Word Based Text Trimming (trailing ellipses) (37)Implicit Styles (37)MouseWheel Support (38)Right Mouse Click (38)Programmatic Clipboard Access (39)Silverlight as a Drop Target (40)Handle Drag-and-Drop Events for Macintosh (41)Webcam and Microphone Support (42)Webcam and Microphone Permissions (45)CompositeTransform (45)Support for all PNG Formats (46)Offline Digital Rights Management (46)MP4 Playback Protected DRM (47)WMS Multicast (47)Output Protection (47)Parser Enhancements (47)Deep Zoom (48)Google Chrome Support (48)Private Mode Browsing (48)Pinned Full-Screen Mode on Secondary Display (48)Media Updates (48)Key Expression Blend Features (50)Interoperability with Visual Studio 2010 (50)PathListBox Control (50)Transition Effects (51)Conditional Behaviors (52)Bindable Properties (52)New Behaviors (52)MVVM Project and Item Templates (54)Design-time data from CLR types (54)Design-time ViewModels (54)Moving Beyond the Browser – Sandboxed Applications (55)Out-of-Browser Windowing Updates (55)Hosting Web Content within Silverlight Applications (55)WebBrowserBrush (56)Notifications (Toast) (57)Window Closing Event (58)Moving Beyond the Browser – Elevated Trust Applications (59)Native Integration (60)File System Access (60)Cross-Domain Networking Access (61)Full File Path on Open and Save Dialogs (61)Sockets Security (61)XAP Signing (61)Silent Install with SLLauncher.exe (65)Custom Window Chrome (65)Full Keyboard in Full Screen Mode (66)Silverlight 4 Resources (68)Tools (68)Training Kit (68)Screencasts (68)Blogs (68)Twitter (69)Key Links (69)CreditsThis document was written in collaboration with many people including most of the Microsoft Silverlight product team, the WCF RIA Services team, and the Expression Blend team. Their help in providing resources, content, and feedback was invaluable.Special thanks to Adam Kinney who authored the Expression Blend content, which is a selected excerpt from the full Expression Blend Technical Whitepaper found at this link/fwlink/?linkid=186042.If you have any feedback on this document, contact:∙John Papa - jopapa@∙Adam Kinney - adkinn@IntroductionSilverlight 4 enhancesthebuilding of business applications, media applications, and applications that reach beyond the browser. New features include printing support, significant enhancements for using forms over data, support for several new languages, full support in the Google Chrome web browser, WCF RIA Services, modular development with MEF, full support in Visual Studio 2010, bi-directional text, web camera and microphone support, rich text editing, improved data binding features, HTML support, MVVM and commanding support, new capabilities for local desktop integration running in the new “Trusted Application” mode such as COM automation and local file access.This document explains the new features in Silverlight, where you can find learning materials, and identifies additional resources.Figure 1Silverlight 4 Multi Touch Puzzle Using the New Trusted Application, WebBrowser Control, and WebBrowserBrush FeaturesEnabling Business Application DevelopmentPrintingSilverlight adds printing support that allows developers to control whether their Silverlightapplication can print itself, how the content is formatted when printed, and determine the content that will appear. For example, you could add a print button to your Silverlight application that opens the Print dialog allows the user to choose the printer, and then prints the Silverlight content.You can print content by first creating an instance of the PrintDocument class, then specifying the content to print, and finally writing code to handle the PrintPage event. You can print the entire Silverlight control by setting PrintPageEventArgs.PageVisual to the layout root of the Silverlight content. Alternatively, you can print a portion of the Silverlight content by settingPrintPageEventArgs.PageVisualto the named UIElement you wish to print. The following code sample prints all content within the UIElement named in the Silverlight application.C#PrintDocument pd = new PrintDocument();pd.PrintPage += (s, args) =>{args.PageVisual = LayoutRoot;};pd.Print();After the PrintPage event occurs, the content from the PageVisual is sent to the selected printer to be printed. Content that is too large to fit in to the PrintableAreawill be clipped. If HasMorePages is true, PrintPage occurs multiple times until HasMorePages is false. If you require customized printing options, you can write code forthe StartPrintand EndPrint events to perform special handling.You can print content that is notin the live visual tree. This allows you to make your printed content look different from your onscreen content. To do this,set PageVisual to a UIElement created in the PrintPage event without adding it to the live visual tree. Another tip to print elements which are not in the live tree is to explicitly run layout on them by calling measure and arrange.Localization with Bi-Directional and Script-Based Text and Right-to-Left SupportSilverlight introduces support for shaped and script languages that flow right to left, such as Arabic and Hebrew. The ability to change the direction of the flow is available to all Silverlight UI elements by setting the FlowDirection property to LeftToRight or RightToLeft. The default bi-directional (Bi-Di) FlowDirection property is from LeftToRight. Setting FlowDirection to RightToLeft on any element sets the alignment to the right, the reading order to right-to-left, and the layout of the control to flow fromthe right to the left. Most UIElement controls inherit the FlowDirection from their parent; however Image, MediaElement, MultiScaleImage, and Popup do not and remain LeftToRight unless overridden explicitly. When brushes and effects are applied to elements whose FlowDirection property is set RightToLeft, the result is flipped horizontally.Extended Language SupportSilverlight 4 now supports several new languages including Thai and Vietnamese as well as multiple Indic scripts both for rendering and input. The following Indic scripts are now supported:RichTextBox ControlSilverlight adds the new RichTextBox control to the standard controls offered by Silverlight. Through the FlowDirection property, the RichTextBoxhas Bi-Directional (Bi-Di) support on content including Runs. It also allows hyperlinks, XAML content, embedding of images, changing the font size, foreground color, and making text bold, italicized, and underlined as well as many other rich text features.The RichTextBox supports the “format then type” feature. For example, with this feature you can choose a format, such as bold or font color of green, and when you start typing the formatting selections you made are appliedto the text you type. Text position and selection APIs are also supported.Another feature of the RichTextBox control is paragraph blocks, which allows different formatting of blocks of text. Built-in keyboard commands can be used to allow shortcuts for clipboard and undo operations. The RichTextBox also supports mouse events, XAML to clipboard features, undo, and language localization.The following image shows the RichTextBox control using the FlowDirection = RightToLeft and displaying Hebrew text.Figure 2RichTextBoxwith FlowDirection of RightToLeftThe following image shows a sample application with a RichTextBox control containing several different types of content, including embedded images, an embedded Silverlight DataGrid, different font sizes, different fonts, foreground colors, bold, and italics.Figure 3RichTextBox ControlThe RichTextBox has a Xaml property that supports serializing text content. You can get the Xaml from the RochTextBox’s Xaml property and save it to isolated storage or perhaps send it to a web service. Youcan also set the content of the RichTextBox control by setting the Xaml property. You can clear the content of a RichTextBox by calling the Blocks property’s Clear method.Text InputSilverlight now enhances its support for IME (Input Method Editors), which is a part of text input used when there are more glyphs than keyboard keys (as with East Asian languages). Enhancements include getting and setting IME conversion modes as well as getting and setting IME active state. In addition,the TextInputStart, TextInputUpdate, and TextInput events have been added to the UIElement controls. These events are effective at determining the text that users input when using IME.Silverlight also has additional event handling for text input via the TextInput event. The TextInput event allows you to get an event from key press generated characters. This includes getting characters that require multiple keyboard presses in order to be entered, such as the “è” in the name “Claudè”.Viewbox ControlSilverlight adds the Viewbox to its list of layout containers. The Viewbox allows precise positioning and flexible resizing support that stretches or scales a single child element to fit the available space. A Viewbox can only contain a single element.The Viewbox’s StretchDirection property determines how to scale its contents. I t prevents the contents of the Viewbox from being scaled to a smaller or larger dimension than the original. Possible values are UpOnly, DownOnly andViewbox Control Both. The Stretch property determines how the content of the Viewbox will be stretched to fill the Viewbox. Possible values are None, Fill, Uniform, and UniformToFill.The example below shows a Viewbox control with the default settings of Stretch=Uniform and StretchDirection=Both. The image inside the Viewbox is 200x200 pixels and will be stretched uniformly to fill the entire smaller Viewbox.XAML<Grid x:Name="LayoutRoot" Background="Red" Width="100"Height="100" ><Viewbox Margin="5"><Image Source="sl4 image.png"/></Viewbox></Grid>Figure 4Viewbox with Default SettingsIf you set the StretchDirection to UpOnly, then the image will only stretch up in size. Since the container is smaller than the image, the image will not stretch and only the upper portion of the image will be visible.Figure 5Viewbox with StretchDirection = UpOnlyAuto-Sizing Columns and Copy from DataGridSilverlight added several new features to the DataGrid control. Through auto-sizing columns, the DataGrid in Silverlightnow has the ability to allow columns to share the remaining width of a DataGrid. This feature makes it easy to define specific widths for some columns in a DataGrid while allowing the other columns to share the remaining width of the DataGrid. For example, you might want to have fixed widths for columns for City, State, and the Postal Code. However, you may want the Name column to use 1/3 of the remaining space and the Address column to use 2/3 of it. The following code would accomplish this using * column widths:XAMLXAML<data:DataGrid AutoGenerateColumns="False" x:Name="dataGrid2"HeadersVisibility="All"><data:DataGrid.Columns><data:DataGridTextColumn Header="Name" Binding="{Binding Name}" Width="*"/><data:DataGridTextColumn Header="Address"Binding="{Binding Address}"Width="2*"/><data:DataGridTextColumn Header="City" Binding="{Binding City}" Width="100"/><data:DataGridTextColumn Header="State" Binding="{Binding State}"Width="50" /><data:DataGridTextColumn Header="Postal Code" Binding="{Binding PostalCode}"Width="80"/></data:DataGrid.Columns></data:DataGrid>Figure 6DataGrid with Auto Sizing ColumnsThe DataGrid now supports MouseWheel scrolling and the FlowDirection property. In addition, DataGrid supports row level copy. This means you can copy a row of a DataGrid to the clipboard and then paste it to another program.Navigation Page Loading ExtensibilitySilverlight 3 introduced page navigation that resolves URIs into pages. Every page had to have an associated XAML and navigating to that page required URIs with paths to those XAML files based upon your project’s file structure. Silverlight4 adds a public ContentLoader property to the Frame control and the INavigationContentLoader interface. Together, these changes allow the developer to generate and initialize instances of pages from URIs using their own scheme, and enable scenarios such as authentication redirects, error pages, and MVC-style navigation.Command Property on ButtonBase and HyperlinkSilverlight adds commanding support commonly used in the Model-View-ViewModel (MVVM) pattern, which provides separation between the View (the Silverlight user control) and the ViewModel (the logic and bindings for the View). Silverlight adds support for commanding on controls that inherit from ButtonBase and Hyperlink. The Command and CommandParameter are exposed to allow binding from a View to a ViewModel without the need for code in the codebehind. You can implement a command by first creating your own DelegateCommand and binding to it from the XAML.For example, a ViewModel may contain a LoadProducts command, which implements the ICommand interface. The LoadProductsCommand accepts a parameter that filters the products that start with a specific letter(s). The following XAML shows how a Button’s Command property could be bound to the LoadProductsCommand and how its CommandParameter property could be bound to a TextBox’s Text property.XAML<UserControl.Resources><local:ProductViewModel x:Key="vm"/></UserControl.Resources><Grid DataContext="{StaticResource vm}" Name="LayoutRoot"><TextBoxx:Name="MyFilterTextBox"/><Button Content="Load" Width="120"Command="{Binding LoadProductsCommand}"CommandParameter="{Binding Path=Text, ElementName=MyFilterTextBox}"/>This XAML binds the Button to the LoadProductsCommand in the ViewModel. You can enable or disable the Button depending on the Boolean return value from the command’s CanExecute method.SelectedValue and SelectedValuePath on the SelectorThese properties enable the use of ComboBox as a look up table. When combining DisplayMemberPath with these you can display one thing but bind to another. All controls that inherit from the Selector class now have SelectedValue and SelectedValuePath properties. You can now set the SelectedValuePathproperty to the string name of the property of the SelectedItem. When this is set, the SelectedValue property will return the SelectedItem’s property with the matching name of the SelectedValuePath.For example, you have a control that derives from Selector (such as the ComboBox control) and it is bound to a collection of Product classes. The Product class has ProductName and ProductId properties. If the SelectedValuePath is set to ProductName , when an item in the Selector control is selected, the SelectedValue property will return the value for the ProductName of the SelectedItem. The following XAML demonstrates this example.XAML<UserControl.Resources><local:ProductViewModel x:Key="vm"/><DataTemplate x:Key="ProductDataTemplate"><Grid><TextBlock TextWrapping="Wrap" Text="{Binding Path=ProductName}" /></Grid></DataTemplate></UserControl.Resources><StackPanel x:Name="LayoutRoot"Background="White" DataContext="{StaticResource vm}"Orientation="Vertical" Margin="10"><ComboBox Height="23" Name="ProductComboBox" VerticalAlignment="Top" Width="120" SelectedValuePath="ProductName"ItemsSource="{Binding Path=Products}"ItemTemplate="{StaticResource ProductDataTemplate}" /><TextBlock Height="23" HorizontalAlignment="Left"Name="SelectedPathTextBlock" Text="{Binding Path=SelectedValue,ElementName=ProductComboBox}" VerticalAlignment="Top" Width="120" /></StackPanel>The result of this XAML is that when you select a product, such as Strawberry, the ProductName of the SelectedItem is displayed in the TextBlock, as shown below.Figure 7TextBlock Bound to SelectedValue of a ComboBoxAnother valuable scenario is when a class, for example a Customer class, has a public string StateId {get;set;} which takes the value “WA” or “NV” etc. You want to display a picker that displays the full state name but when you pick a value pushes the short name into Customer.StateId. You can create a State object with LongName and ShortName and a collection of all the States called StatesCollection. Then you bind ComboBox.ItemsSource to StatesCollection with DisplayMemberPath=LongName, SelectedValuePath=ShortName and bind SelectedValue to the current Customer StateId property. In the end, you will display “Washington” but SelectedValue is “WA” and so Customer.StateId gets set to “WA”XAML<StackPanel x:Name="LayoutRoot"Background="White" DataContext="{StaticResource customerVM}"Orientation="Vertical" Margin="10"><ComboBox Height="23" Name="ProductComboBox" VerticalAlignment="Top" Width="120"SelectedValue=”StateId”DisplayMemberPath=”LongName” SelectedValuePath="ShortName"ItemsSource="{Binding Source="{StaticResource statesCollection}}"ItemTemplate="{StaticResource ProductDataTemplate}" /></StackPanel>Support for Referer HeaderSilverlight allows the Referer request header for both in-browser and out-of-browser scenarios on all networking requests used by WebClient and HttpWebRequest when they use the Client networking stack. This enables services like Live Mesh to determine where the requests originated. The Referer header is a request header field that is automatically set to the base URI of the client from which the Request-URI was obtained. The Referer request header allows a server to generate lists of back links to resources for logging and caching optimization.UDP Multicast Client SupportSilverlight enables UDP multicast for one-to-many communication over an IP infrastructure. This efficiently scales to a large receiver population. There are two key shapes for multicast groups:∙Single Source Multicast (one-to-many).Sockets.UdpSingleSourceMulticastClient∙Any Source Multicast (many-to-many).Sockets.UdpAnySourceMulticastClientTo make multicast group accessible to Silverlight, you need to expose a policy responder (just like Sockets and HTTP).Networking EnhancementsSilverlight 4 adds the following features to the networking stack:∙UploadProgress support on the client networking stack now exists. This allows you to be notified as content is being uploaded so you can notify the user.∙Caching support on the client networking stack has been added.∙Sockets policy file retrieval via HTTP is also new.∙Accept-Language header has been added.WCF TCP-based BindingWCF in Silverlight now offers a TCP-based binding, which enables communicating with WCF services configured with NetTcpBinding. Note that no security is supported in this release.WCF PollingDuplex ImprovementsPollingDuplex now supports a new “multiple messages per poll” mode, where HTTP chunking is used to stream many messages in response to a client poll.Authentication Support with ClientHttpWebRequestSilverlight adds the ability to pass user credentials from the application to the server to support NTLM, Basic, and Digest authentication. This allows Silverlight applications to pass user credentials for authentication by services such as Data Services or Live Mesh.A Silverlight application can now set the Credentials API with a username and password when Websites require the authorization request header to be sent with a network request to properly authorize users. When a user has already logged in to the machine and the credentials have been saved to the OS, the client may use these default credentials to authenticate when making a client networking request. This makes the most sense in scenarios (such as SharePoint ) that use NTLM authentication.The code below demonstrates how to pass network credentials using the new APIs. Notice that the UseDefaultCredentials property is set to false. When UseDefaultCredentials is set to true, the Credentials property is ignored and the credentials are retrieved from the local m achine’s session. In the code above, the credentials are supplied in code, so the UseDefaultCredentials must be set to false.C#var username = "myTwitterId";var password = "myTwitterPassword";var twitterUri =@"/statuses/friends_timeline/{0}.xml?count=50";var uriString = string.Format(twitterUri, username);WebClient request = new WebClient();WebRequest.RegisterPrefix("http://", WebRequestCreator.ClientHttp);eDefaultCredentials = false;request.Credentials = new NetworkCredential(username, password);request.DownloadStringCompleted += newDownloadStringCompletedEventHandler(client_DownloadStringCompleted);request.DownloadStringAsync(new Uri(uriString));Custom authentication is now supported for in browser and out of browser applications through programmatic access to the Authorization header via the Headers collection on WebRequest. Also, you will need the clientaccesspolicy.xml file to opt-in to the Authorization header being sent.IDataErrorInfoSilverlight adds the IDataErrorInfo interface enables the reporting of validation errors that a user interface can bind to. When an entity implements this interface and the entity is involved in a bindingoperation, it invokes the indexer to validate the properties. The bound target properties in the UI will receive the error messages and display the validation states if the ValidatesOnDataErrors property is set to true.The IDataErrorInfo interface exposes an Error property and a string indexer. The Error property should return an error message explaining the error with the object. The indexer should return the error message for the property with the given name passed to the indexer.C#publicinterface IDataErrorInfo{string Error { get; }stringthis[string columnName] { get; }}You can implement validation by executing the IDataErrorInfo interface on an entity model as shown in the code sample below on the Employee. The Employee has custom validation rules that execute when changes occur in the bound UI elements that have ValidatesOnDataErrors set to true.C#publicclass Employee : INotifyPropertyChanged, IDataErrorInfo{private ValidationHandler validationHandler = new ValidationHandler();privatestring _FirstName;publicstring FirstName{get { return _FirstName; }set{_FirstName = value;NotifyPropertyChanged("FirstName");bool valid = validationHandler.ValidateRule("FirstName","First Name must be at least 5 letters!",() => (value.Length >= 5));}}privatefloat _TaxPercent;publicfloat TaxPercent{get { return _TaxPercent; }set{if (_TaxPercent != value){if (value>= 1)value /= 100;_TaxPercent = value;NotifyPropertyChanged("TaxPercent");bool valid = validationHandler.ValidateRule("TaxPercent", "The tax has to be positive!",() => (value> 0));}}}protectedvoid NotifyPropertyChanged(string PropertyName){if (null != PropertyChanged)PropertyChanged(this, new PropertyChangedEventArgs(PropertyName)); }publicevent PropertyChangedEventHandler PropertyChanged;publicstring Error{get { returnnull; }}publicstringthis[string columnName]{get{if (this.validationHandler.BrokenRuleExists(columnName)){returnthis.validationHandler[columnName];}returnnull;}}}publicclass ValidationHandler{private Dictionary<string, string> BrokenRules { get; set; }public ValidationHandler(){BrokenRules = new Dictionary<string, string>();}publicstringthis[string property]{get{returnthis.BrokenRules[property];}}publicbool BrokenRuleExists(string property){return BrokenRules.ContainsKey(property);}publicbool ValidateRule(string property,string message, Func<bool> ruleCheck){if (!ruleCheck()){this.BrokenRules.Add(property, message);returnfalse;}else{RemoveBrokenRule(property);returntrue;}}publicvoid RemoveBrokenRule(string property){if (this.BrokenRules.ContainsKey(property)){this.BrokenRules.Remove(property);}}}The XAML for these UI elements is shown below.XAML<TextBox x:Name="FirstNameTextBox"Text="{Binding Path=FirstName, Mode=TwoWay,ValidatesOnDataErrors=True}" /><TextBox x:Name="TaxPercentTextBox"Text="{Binding Path=TaxPercent, Mode=TwoWay,ValidatesOnDataErrors=True}" />When invalid values are entered into these controls, the validation kicks in and displays to the user as shown below.Figure 8Data Validation using IDataErrorInfoINotifyDataErrorInfoIDataErrorInfo is limited to validating on a per property basis. However, Silverlight4 also adds the INotifyDataErrorInfo interface that allows validation across properties of an entity. It also allows entity objects to enable notification of data errors in the UI. INotifyDataErrorInfo allows developers to provide custom, asynchronous validation support to access server-side validation logic. It exposes a HasErrors property to indicate if there are any errors and has a GetErrors method to retrieve the errors. The ErrorsChanged event is raised when new errors are added. If the binding property ValidatesOnNotifyDataErrors is set to true and the source object implements the interface, the binding。
Sliverlight 整理文档
Sliverlight 整理文档Sliverlight概述Microsoft silverlight 是一种跨浏览器跨平台的 .NET Framework 实现,用于 Web 生成和提供下一代媒体体验和丰富的交互式应用程序(RIA)。
Silverlight 统一了了服务器、Web 和桌面的功能。
统一了托管代码和动态语言声明性编程和传统编程以及windows Presentation Foundtion (WPF) 的功能。
Sileverlight 允许创建具有一下功能的最先进的应用程序:它是一种跨浏览器、跨平台的技术。
它在所常见的 Web浏览器中运行,包括Microsoft windows和AppleMac osx 上运行。
它由可在数秒内安装的很小的下载程序支持。
它对视频和音频进行处理。
它将视频品质调到各种环境:从移动设备到桌面浏览器以及720p HDTV 视频模式。
它包括用户可以直接在浏览器中操作(拖动、旋转、缩放)的足够清晰地图形。
它读取数据并更新显示内容,但是不通过刷新整个页面来打断用户。
应用程序可以在 web 浏览器中运行,你也可以配置应用程序,使用户可以在自己的计算机上运行该程序(浏览器外)。
Silverlight 的功能Silverlight 将多种技术组合到单个开发平台,可以允许你根据需要选择合适的工具和编程语言,功能如下:WPF和XAML。
Silverlight 包含WPF技术的一个子集,从而大大扩展了浏览器中用于创建UI的元素。
Silverlight 允许你创建沉侵式图形、动画、媒体、和其他的丰富的客户端功能,使基于浏览器UI远超单独使用 HTML提供的效果。
可扩展应用程序标记语言(XAML)提供用于创建元素的声明性语法。
对JavaScript的扩展。
Silverlight提供对浏览器脚本语言的扩展,可以控制浏览器UI,包括WPF元素。
跨浏览器支持,Silverlight可以在所有浏览器上自如运行。
Silverlight4.0实务应用范例讲座
22
TestPage.html .html格式的测试页面,透过 <Object>标记承载.xap档案。
<objectdata="data:application/xsilverlight,"type="application/xsilverlight-2b2"width="100%"height="100%" > <paramname="source"value="Cl ientBin/SilverlightApplication8.x ap"/> </object>
Silverlight应用程序的开发架构
- DevelopRichWebApplicationwith Silverlight
为何要把应用程序分很多层?
降低相依性
便于维护与扩充、容易切割、降低开发/异动成本
2
What's Silverlight?
- DevelopRichWebApplicationwith Silverlight
3
解决方案总是从问题而来
- DevelopRichWebApplicationwith Silverlight
Silverlight的5W 1H
WHAT -什么是Silverlight?
21
•TestPage.aspx .aspx格式的测试页面,内含 Silverlight控件(Web Control)
<asp:SilverlightID="Xaml1"runat ="server"Source="~/ClientBin/Sil verlightApplication8.xap"Minimu mVersion="4.0.30523"Width="1 00%"Height="100%" />
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Sliverlight 整理文档Sliverlight概述Microsoft silverlight 是一种跨浏览器跨平台的 .NET Framework 实现,用于 Web 生成和提供下一代媒体体验和丰富的交互式应用程序(RIA)。
Silverlight 统一了了服务器、Web 和桌面的功能。
统一了托管代码和动态语言声明性编程和传统编程以及windows Presentation Foundtion (WPF) 的功能。
Sileverlight 允许创建具有一下功能的最先进的应用程序:它是一种跨浏览器、跨平台的技术。
它在所常见的 Web浏览器中运行,包括Microsoft windows和AppleMac osx 上运行。
它由可在数秒内安装的很小的下载程序支持。
它对视频和音频进行处理。
它将视频品质调到各种环境:从移动设备到桌面浏览器以及720p HDTV 视频模式。
它包括用户可以直接在浏览器中操作(拖动、旋转、缩放)的足够清晰地图形。
它读取数据并更新显示内容,但是不通过刷新整个页面来打断用户。
应用程序可以在 web 浏览器中运行,你也可以配置应用程序,使用户可以在自己的计算机上运行该程序(浏览器外)。
Silverlight 的功能Silverlight 将多种技术组合到单个开发平台,可以允许你根据需要选择合适的工具和编程语言,功能如下:WPF和XAML。
Silverlight 包含WPF技术的一个子集,从而大大扩展了浏览器中用于创建UI的元素。
Silverlight 允许你创建沉侵式图形、动画、媒体、和其他的丰富的客户端功能,使基于浏览器UI远超单独使用 HTML提供的效果。
可扩展应用程序标记语言(XAML)提供用于创建元素的声明性语法。
对JavaScript的扩展。
Silverlight提供对浏览器脚本语言的扩展,可以控制浏览器UI,包括WPF元素。
跨浏览器支持,Silverlight可以在所有浏览器上自如运行。
你可以设计和开发应用程序而不必担心用户具有何种浏览器或平台。
与现有应用程序集成。
Silverlight可以与现有的JavaScript和 AJAX代码无缝集成,以增强你已经有的功能。
可以访问.NET Framework 编程模型。
可以使用诸如IronPython 的语言以及诸如c#和Visual Studio和Expression Blend 之类的开发工具快速创建 Silverlight应用程序。
网络支持。
Silverlight包括对TCP上的HTTP的支持。
可以连接到WCF SOAP 或者 AJAX服务并接收XML、JSON或RSS数据。
LINQ。
Silverlight包括语言集成查询。
这种查询允许你使用直观本机语法和.NET Fromwork 语言中的强类型对象来编程进行数据访问。
Sliverlight包含了.NET框架的一个跨平台,跨区浏览器的版本,促成了在浏览器中运行的一个丰富的.NET开发平台。
开发人员可以使用任何一门.NET语言来编写Sliverlight应用。
Sliverlight版本提供了能促成精妙的RIA应用开发环境的一套丰富的功能集。
这些功能包括:WPF UI框架:Sliverlight包括了一个基于WPF的副用户界面框架,该框架将极大的方便建造丰富的Web应用,其中包括强大的图像和动画引擎,以及对象控件,布局管理,数据绑定,样式和模板皮肤这样高级的UI功能的支持。
Sliverlight中的WPFUI框架是与完整的.NET 框架中的WPFUI框架特性相兼容的一个子集,允许开发人员重用技能,控件,代码和内容来同事建造跨浏览器的Web应用,以及丰富的桌面Windows应用。
丰富的控件:Sliverlight包括了一整套丰富的内置控件,可为开发人员和美工设计是用来快速的建造应用,包括核心的单表控件,内置的布局管理面板,常见功能控件,数据操作控件,内置的控件支持一个丰富的控件模板,允许开发人员和美工实际是一起合作建造精美的解决方案。
网络支持:Silverlight 包括对TCP 上的HTTP 的支持。
可以连接到WCF、SOAP 或 AJAX 服务并接收XML、JSON 或RSS 数据。
此外,您可以使用Silverlight 构建多播客户端。
Silverlight 版本4 中的.Sockets命名空间添加了对UDP 多播客户端的支持。
Sliverlight的安装安装Silverlight 4 Tools for Visual Studio 2010:在您安装 Silverlight 4 Tools for Visual Studio 2010 时,针对 Silverlight 4 的选项将出现。
下图显示"新建 Silverlight 应用程序"对话框中的 Silverlight 4 选项。
在您创建新的Silverlight 项目时,将会看到许多在Visual Studio 中常见的工具和窗口。
截止到此,Sliverlight安装完成。
其创建的过程和基本的创建Windows应用程序差不多,只不过是选择的是VB中的Sliverlight。
创建新的Silverlight 类库项目启动Visual Studio 2010。
在"文件"菜单上单击"新建",再单击"项目"。
将显示"新建项目"对话框。
在"已安装的模板"窗格中,展开"Visual C#"或"Visual Basic"节点,然后选择"Silverlight"。
在模板列表中,选择"Silverlight 类库"。
为该类库指定名称和位置,然后单击"确定"。
"添加Silverlight 类库"对话框将出现。
从"Silverlight 版本"下拉列表中,选择所需的Silverlight 版本,然后单击"确定"。
Web 开发人员和图形设计人员可以通过各种方式来创建Silverlight 应用程序。
可以使用Silverlight 标记来创建媒体和图形,并使用动态语言和托管代码来操作它们。
Silverlight 还允许您使用专业级别的工具,如使用Visual Studio 进行编码和使用Microsoft Expression Blend 进行布局和图形设计。
Sliverlight是一种很容易用的技术,其主要依据就是XAML语言,关于XAML,这里不再讨论。
创建SilverLight 应用程序可以使用.NET Fromwork 支持的任何语言来创建Silverlight应用程序。
Visual Studio和Expression Blend提供对开发Silverlight应用程序的支持。
通过Silverlight 可以创建同时使用HEML和WPF元素的网页。
像HTML一样,XAML允许使用声明性语法创建基于Web 的应用程序的UI,不过XAML可以提供功能更强的元素。
1.安装Silverlight4 Tools for Visual Studio 2010在已安装Visual Studio2010或Visual Web Developer 2010 Express 后,安装Silverlight4 Tools for Visual Studio2010。
下面显示Silverlight 项目模版的一个示例。
图1-1在你安Silverlight4 Tools for Visual Studio2010 时,针对Silverlight4 的选项将出现。
下面显示“新建Silverlight应用程序”对话框中的Silverlight4选项图1-2当进行Silverlight开发时,还要用到其他工具,Silverlight4 SDK、Expression Blen、Deep Zoom Composer、Silverlight.js、Sliverlight.supportedUserAgent.js等。
用于Visual Studio2010的Silverlight设置器为创建Silverlight和WPF 应用程序提供可视化设计支持。
你可以从“工具箱”中拖动控件,然后在“属性”窗口中设置属性,以此为应用程序生成用户界面,还可以直接在XAML视图中编辑XAML,下图显示了Silverlight 设计器及其支持的某些窗口。
图1-3本主题包括以下各节:设计视图、XAML视图、“属性”窗口、“数据源”窗口、“文档大纲”窗口、帮助创建应用程序和控件、相关主题。
2.创建新Silverlight项目启动Visual Studio2010。
在“文件”菜单上单击“新建”,再单击“项目”。
将显示“新建项目”对话框。
在“已安装的面板”窗格中,展开“Visual C#”,然后选“Silverlight”在面板列表中,选择“Silverlight应用程序”,如图1-1所示。
为该应用程序指定名称和位置,然后单击“确定”,将显示“新建Silverlight应用程序”对话框,如图1-2所示。
选择用于承载Silverlight应用程序的方法。
如果你不想使用网站来承载Silverlight应用程序,请取消选中“在新网站中承载Silverlight应用程序”复选框,而后,将生成HTML 测试页以承载应用程序。
如果你想要在解决方案中添加一个单独的 web应用程序项目,以承载Silverlight 应用程序,请选择“在新网站中承载Silverlight应用程序”复选框。
如果选择此选项,还必须指定“新的Web项目名称”和“新的 Web项目类型”7.单击“确定”按钮。
8.若要生成Silverlight应用程序项目,请在“生成”菜单中单击“生成解决方案”。
若要调试Silverlight应用程序项目,请在“调试”菜单中单击“启动调试”。
若要运行Silverlight 应用程序项目,请在“调试”菜单中单击“开始执行(不调试)”。
9,若选择了“新建Silverlight应用程序”对话框中的“在新网站中承载Silverlight应用程序”复选框,将创建一个网站并将其添加到Silverlight解决方案。
也按照新建“Silverlight应用程序”的步骤,新建“Silverlight类库”。