Top 10 Things to Know About Silverlight

Top 10 Things to Know About Silverlight,第1张

概述Introduction Silverlight is the Microsoft portal for developing Rich Internet Applications (RIA). Until now Microsoft has released many versions of Silverlight, each version has been bundled with a lo Introduction

Silverlight is the Microsoft portal for develoPing Rich Internet Applications (RIA). Until Now Microsoft has released many versions of Silverlight,each version has been bundled with a lot of new features. The latest of them is Silverlight ver. 4.0. For more introductions,tutorials,blogs or vIDeos visit the official Silverlight website http://www.silverlight.net/.

In this article we'll highlight the top 10 things to kNow about Silverlight.This would help developers who are relatively new to the Silverlight platform to understand how SIlverlight works. This top 10 section does not include the information about the Silverlight platform for mobile devices.

Silverlight SDK

This is a first and foremost candIDate for the developers to be aware of. As the name suggests it is the software development kit for develoPing Silverlight applications using Microsoft Visual Studio. It contains the samples,documentation,librarIEs and tools to develop Silverlight applications.

Silverlight development is supported in Microsoft Visual Studio 2005,2008 & 2010. If you are using Microsoft Visual Studio 2005 or 2008 then you need to download and install Silverlight SDK explicitly. In case you have installed Microsoft Visual Studio 2010 then you don't have to worry about it because Silverlight comes by default.

For downloading the latest version of Silverlight SDK here.

Silverlight Project Structure

 

normally when creating a new Silverlight application project in Microsoft Visual Studio it would create two projects. The project which has the XAML files is the Silverlight clIEnt and the other project would be a web application which would act as a host for the Silverlight clIEnt. The developers can also create Silverlight librarIEs that gives the provision to use them on multiple web host applications.

fig 1.0 shows the sample Silverlight application structure.

 

 

Hosting Silverlight Applications on Web Pages

You Could also create the Silverlight project without a host web project. But even then when you run the Silverlight clIEnt you would notice the content getting hosted implicitly onto a web page by Microsoft Visual Studio.

As the Silverlight application is built with XAML it cannot be delivered to the end user's browser directly. This is the reason for which a hosting web page is required.

The Silverlight content can be hosted on any type of web pages from HTML,aspx to Java and PHP. Below is the content on the web page which is required for hosting the Silverlight content onto it.

 

  <script type="text/JavaScript" src="Silverlight.Js"></script>  <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" wIDth="100%" height="100%">  		  <param name="source" value="ClIEntBin/SilverlightApplication1.xap"/>  		  <param name="onError" value="onSilverlightError" />  		  <param name="background" value="white" />  		  <param name="minRuntimeVersion" value="4.0.50826.0" />  		  <param name="autoUpgrade" value="true" />  		  <a href="http://go.microsoft.com/fw@R_404_6862@/?@R_404_6862@ID=149156&v=4.0.50826.0" >   			  <img src="http://go.microsoft.com/fw@R_404_6862@/?@R_404_6862@ID=161376" alt="Get Microsoft Silverlight" />  		  </a>  </object>

 

All the Silverlight windows would use the same web page for displaying their content. There should be a start up or an entry point window in the Silverlight clIEnt.

Silverlight Based Application Package

The extension of the Silverlight application package is .XAP. The XAP file is generated as a result of building the Silverlight clIEnt application. This file is the one which will be hosted onto the web page. When the user requests a Silverlight application through web this .XAP file would be streamed to the clIEnt and stored in a separate workspace. This makes Silverlight as a powerful RIA.

The contents of the .XAP files are the .ddl files of the Silverlight clIEnt application and an AppManifest.xml file. The AppManifest.xml contains the dll information,entry point information,etc.

XAP is of a compressed .zip format which leads the content to be extracted by changing the extension to .zip. When you build the Silverlight application in Microsoft Visual Studio 2010 you would notice the XAP file is placed under the folder called ClIEntBin on the Web project as shown in fig 2.0.

 

Silverlight Plug-in

Once the XAP file is downloaded to the clIEnt machine the tool which is responsible for executing the Silverlight content and displaying the Silverlight content on the browser is the Silverlight plug-in. This is a free plug-in from Microsoft as this has to be installed on the clIEnt machines in order for the end user to get the Silverlight application to show up on the browser.

The Silverlight plug-in contains the core Silverlight CLR component whose default location on the clIEnt machine is C:/Program files/Microsoft Silverlight/ 4.0.50401.0.

The Silverlight plug-in IDentifIEs the clIEnt DLLs and the entry point assembly using the AppManifest.xml file in XAP. If the user has not installed the Silverlight plug-in then he will be prompted for the installation on access of a Silverlight application.

Silverlight.Js file

If you notice the Silverlight package hosting web page you would find a JavaScript file added to it called Silverlight.Js. This file is responsible to initiate the Silverlight plug-in. The createObject and createObjectEx can be called explicitly on the web page.

Multimedia Support

Most people prefer Silverlight in order to Leverage its media support. Silverlight application has a rich support for multimedia. The MediaElement control is the one to do the trick. All the developer needs to do is simply drag -n- drop the MediaElement and point a media file available on the server to it. A lot of customization can be done to this MediaElement control in XAML. In fact a good looking media player can be developed and embedded into the application.

Below is a sample XAML code.

 

  <MediaElement WIDth="472" Height="328" Source="MyVIDeo.wmv">  </MediaElement>

 

Animation Support

As Silverlight uses XAML as the designer which is that same for WPF it is evIDent that Silverlight exposes a rich set of animation support. You Could also define storyboards onto Silverlight windows.

For an in-depth look on Silverlight animation check the MSDN.

WCF RIA Services

WCF RIA services are available in .NET Framework 4.0 which eases the task of sharing the business logic and business objects between the Silverlight clIEnt and the server project in a WCF manner. Without this feature in order to share the business logic / entitIEs between the clIEnt and server projects the developer would end up in writing duplicate code at both places.

Availability Silverlight Business Application Template

Silverlight 4.0 on Microsoft Visual Studio 2010 is supplemented with the Silverlight business application template. A Silverlight business application project when created,adds up all the generic things that has to be created for a business application like Login,styles,navigation,commonly used controls,etc. fig 3.0 shows the screenshot of the project template.

 

Conclusion

Hope this article clearly highlights the top 10 things to kNow about Silverlight. This top 10 List is purely based on my own instincts. As a reader if you have any conTradiction then please use the comments section to emphasize it.

Happy Coding!

总结

以上是内存溢出为你收集整理的Top 10 Things to Know About Silverlight全部内容,希望文章能够帮你解决Top 10 Things to Know About Silverlight所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1075134.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-26
下一篇 2022-05-26

发表评论

登录后才能评论

评论列表(0条)

保存