Pages

Monday, 30 August 2010

SilverLight from Microsoft

“In this world, there are some known things and some unknown things, and in between are the doors of perception “and I m here to set right your perception for SilverLight.

Microsoft has the best development IDE on the market. If you are a .NET/Microsoft developer, you already have the majority of the skills necessary to start developing in SilverLight!!

What is SilverLight??

Windows users won’t really care whether the highly rich web application that they are viewing is using SilverLight or Flash. Both technologies require a small plug-in to be installed and once done, both are invisible until the user navigates a page that require their services. But we as developers need to care about which technology to choose. We need our applications to run on as many platforms as possible, and SilverLight applications will run on many browsers such as IE and Firefox on Windows, and Safari, Opera on the Mac.

OK let’s not divert from the topic, let me technically provide SilverLight defination. “SilverLight is a new cross-browser, cross-platform implementation of the .NET Framework for building and delivering the next generation of media experiences and Rich Interactive Applications (RIA) for the web.”

SilverLight doesn't require ASP.NET to be used on the backend web-server; it means you can use SilverLight with PHP on Linux if u wish to. Thus the saying goes “Microsoft rebooted the Web “.

How the name Silver Light??

Below are the top ten names that got rejected before the name SilverLight came up:-

1. Microsoft Windows Presentation Foundation Live Rich Client ActiveX Player R2 Ultimate Edition Service Pack 1 CTP (WPFLRCAPR2UESP1CTP).

2. Redlight.

3. Microsoft 2.0

4. Microsoft Light New User Experience.

5. MicroMedia Player.

6. Windows Technology Foundation.

7. Non-Windows Presentation Foundation.

8. David.

9. AJAX - Asynchronous JavaScript and XAML.

10. GrayLuminosity.

A sample SilverLight Application??

Here we are going to create a simple SilverLight Application.

Steps to be followed:-

1. Open Visual Studio and select the File->New project.

2. After selecting the SilverLight Application, enter name and location as below and click OK.

3. A Pop -Up gets displayed.

4. You need a webpage to host the SilverLight components that you develop. Visual Studio makes this job easier just by prompting you to automatically create a website.

5. Thus when you create a new SilverLight Application using Visual Studio 2008, it creates loads of files by default.

Let’s detail out each of these files

• App.xaml:

It is used to declare element which are available through-out the application. You can also declare Global variables just same as in Global.asax in Asp.net.

• App.xaml.cs:

A code-behind file for the App.xaml file.

• MainPage.xaml:

o This is the page where all the UI elements that you require needs to be added. All UI elements in a .xaml control must be placed within a layout panel.

• ClientBin folder is used to place the .xap file of SilverLight application. You can keep this anywhere in your web application but this is the default that is used by the SilverLight.

• SilverLight.js is a helper file which enables Web sites to create advanced SilverLight installation and instantiation experiences.

• SilverLightApplicationTestPage.aspx is the web page that will be displayed once the SilverLight application is built error-free and executed.

When you compile your Silver light Application project, it will compile all .xaml files and various other resources in to a single assembly file with the extension .xap and will have the same file name as your project name.

What is XAP?

XAP (pronounced as ZAP) is the file extension for a SilverLight-based application Package (.xap). This file contains the compressed assemblies and resources of a SilverLight 2.0 application. This .xap file contains the XAML and code from your .xaml files and will be executed by the SilverLight plugin installed.

One nice thing about Visual studio is, it will show you a preview of the page as you type the xaml tags. When you complete typing the above xaml tags in your .xaml page, you will see the design preview in Visual Studio.

Thus you have created your first Silver Light application. You can also zoom the Rectangle box above to 100%. Now just built the application and run it. You are done!!

No comments:

Post a Comment