首页 | 主题 | 图库 | 问答 | 文摘 | 原创 | 百科

历史 | 地理 | 人物 | 艺术 | 体育 | 科学 | 音乐 | 电影 | 信息技术 | 世界遗产

 开放、中立,源自维基百科

个人工具


Microsoft Silverlight

维库,知识与思想的自由文库

跳转到: 导航, 搜索
Microsoft Silverlight

Silverlight logo
开发者 Microsoft
最新穩定版 1.0 RC / 1.1 Alpha refresh / July 27 2007
操作系统 Microsoft Windows, Mac OS X
类型 Web Application framework
许可协议 EULA
Silverlight homepage

Microsoft Silverlight(舊稱Windows Presentation Foundation/Everywhere,即WPF/E),有中文譯為銀光,是美國微軟公司瀏覽器、跨平臺的 RIA web 解決方案,主要有以下特點:

  • 在Web上提供豐富的用戶體驗
    • 空前的富媒體體驗以及網路應用。
    • 強大的基於向量的圖形。
    • 無敵的從Mobile到HD品質的視頻以及音訊。
    • 在有硬體加速支援下,最高達15倍的視頻編碼速度。
    • 移動設備支援。
  • 快速,更具生產力的開發
    • 集成現有的網路開發技術及資源。
    • Web以及桌面一致的表現層,保證了開發的低成本性。
    • 基於標準的可驗證的開發技術。
    • 為開發人員以及設計人員提供了廣泛的工具支援,並且建立了相應的開發設計生態圈。
  • 快速部署
    • 簡單按需安裝的SilverLight瀏覽器外掛程式 。
    • 靈活的基於視頻及動畫的廣告嵌入方案。
    • 低成本的流媒體解決方案,基於榮獲艾美獎榮譽的Windows Media技術。
    • 內容訪問保護技術。
    • 在Microsoft Expression Media Encoder的支援下,加速編碼並且發佈基於視頻的體驗。

Silverlight 包含XAML頁面佈局語言,為WPF的子集合,配合JavaScript,可跨各家平台(Windows VistaWindows XP,以及Mac OS X),利用內插(plug-in)技術,可執行於網頁瀏覽器之上,包括:Internet ExplorerMozilla FirefoxSafariNetscape

Microsoft Silverlight可視為.NET平台上的AJAX技術,功能包括向量圖形(vector graphics)、影像、視訊、動畫和文字等。Microsoft Silverlight省略了部份XAML Browser Application的功能,如立體圖形、文件和硬體加速等功能。一個Microsoft Silverlight專案會有4個檔案:

  • 顯示內容的HTML檔案
  • aghost.js,以及eventhandlers.js兩個檔案
  • XAML檔案
  • JavaScript檔案

第一個WPF/E CTP版本已於2006年12月釋出。2007年中預計推出最後完整版。

[编辑] Silverlight 1.0

A Silverlight 1.0 application hosted in Internet Explorer
A Silverlight 1.0 application hosted in Internet Explorer

Silverlight 1.0 由許多核心展示層架構組成,這關係到使用者界面(UI),使用者輸入(user input),基本使用者介面控制元件(basic UI controls),圖形(graphics)和動畫(animation)、媒體播放(media playback),數位權管理(DRM)的支援,以及DOM的整合。.[1] 其組件如下:

  • 輸入(Input) - handling input from devices like keyboard, mouse, stylus etc.
  • 使用者介面核心(UI core) - managing rendering of bitmap images (including compressed raster images like JPEG), vector graphics, text and animations.
  • 媒體(Media) - playback of MP3, Windows Media and VC-1 streams.
  • XAML - to allow the UI layout to be created using XAML markup language.

一個銀光程式(Silverlight)的起點是從網頁呼叫銀光元件(Silverlight control)開始,必須載入XAML 檔。The XAML file 包含一個 Canvas 物件, 扮演著一個placeholder的角色. Silverlight 提供各種不同的幾何基元,像是:線、橢圓以及其它形狀, to elements like text, images, and media etc. The elements are properly positioned to achieve the desired layout. Any arbitrary shape can be created as well. These elements can be animated using Event triggers; some animation effects are predefined, others can be created as composite of the pre-defined effects. Events like keyboard or mouse movements can also raise Events which can be handled by custom scripts.[2]

Programmatic manipulation of the UI is achieved by using scripting languages to modify the Document Object Model of the Silverlight Canvas object.[1] To facilitate this, Silverlight exposes a DOM API, accessible from any scripting language supported by Silverlight, which in version 1.0 release is JavaScript only. However, there are no UI widgets built in. The native widgets of the browser must be overlayed on top of the Silverlight Canvas for user input. Support for data formats is limited to XML, POX and JSON only.[1]

[编辑] 範例

<source lang="html4strict"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>UntitledProject1</title> <script type="text/javascript" src="Silverlight.js"></script> <script type="text/javascript" src="Page.xaml.js"></script> <style type="text/css"> .silverlightHost { height: 480px; width: 640px; } </style> <script type="text/javascript"> function createSilverlight()

       {
           var scene = new UntitledProject1.Page();
           Silverlight.createObjectEx({

source: "Page.xaml", parentElement: document.getElementById("SilverlightControlHost"), id: "SilverlightControl", properties: { width: "100%", height: "100%", version: "1.0" }, events: { onLoad: Silverlight.createDelegate(scene, scene.handleLoad) }

           });
       }


       if (!window.Silverlight) 
           window.Silverlight = {};
       Silverlight.createDelegate = function(instance, method) {
           return function() {

return method.apply(instance, arguments);

           }
       }

</script> </head>

<body>

<script type="text/javascript"> createSilverlight(); </script>

</body> </html> </source>

[编辑] 外部連結



其它语言
AD Links