Microsoft Silverlight
维库,知识与思想的自由文库
Microsoft Silverlight(舊稱Windows Presentation Foundation/Everywhere,即WPF/E),有中文譯為銀光,是美國微軟公司跨瀏覽器、跨平臺的 RIA web 解決方案,主要有以下特點:
Silverlight 包含XAML頁面佈局語言,為WPF的子集合,配合JavaScript,可跨各家平台(Windows Vista、Windows XP,以及Mac OS X),利用內插(plug-in)技術,可執行於網頁瀏覽器之上,包括:Internet Explorer、Mozilla Firefox、Safari和Netscape。 Microsoft Silverlight可視為.NET平台上的AJAX技術,功能包括向量圖形(vector graphics)、影像、視訊、動畫和文字等。Microsoft Silverlight省略了部份XAML Browser Application的功能,如立體圖形、文件和硬體加速等功能。一個Microsoft Silverlight專案會有4個檔案:
第一個WPF/E CTP版本已於2006年12月釋出。2007年中預計推出最後完整版。 [编辑] Silverlight 1.0
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] 其組件如下:
一個銀光程式(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> [编辑] 外部連結
| |||||||||||||||||||||||||||||||||||||||||||||||||||||


