Click here to Skip to main content
13,295,178 members (62,936 online)
Click here to Skip to main content
Add your own
alternative version


29 bookmarked
Posted 26 May 2009

Silverlight for Dummies - Why Silverlight?

, 26 May 2009
Rate this:
Please Sign up or sign in to vote.
This article explains why Silverlight is needed. Explains the basic things which are required to understand the working of silverlight. Beginners must start with this article.


This article explains about why Silverlight is needed, why we should move to Silverlight and it also explains about the relationship between Web Server, Web Browser and Silverlight.

Why Silverlight?

What made me really invest time in learning Silverlight? Hope this will be helpful for beginners who want to know about "Why Silverlight?"

I will try to write a post daily but my first post will concentrate on “What made me move to Silverlight?”. The second post will include more on the technical side of Silverlight. After a few posts, I will be writing one application which will help us to understand Silverlight starting from Login, WCF, Data Binding, Prism, ADO.NET Entity framework, which will give us a complete flow and help us to understand Silverlight. Please feel free to write to me at for any suggestions or questions. Please do leave comments on the post.

So let’s start.

Before beginning to know more on Silverlight, first we should know:

  • Why Silverlight?
  • Importance of Silverlight?
  • Where to use?
  • Underlying architecture

Before I begin with any new language, I always want to know what language it is? How to use it? And what is the architecture behind it?

I will answer these questions with a case study. In that way, you all will understand it very clearly.

I got one project last year. The client need was to develop a website for some product which will have tree control, menu item, UI elements and business logic involved in it, etc. Then I took the project and started working on it.

I wrote JavaScript to do few things. When we had a small demo with the client, he was very upset and said “Is this a way to write JavaScript code? What code have you written?? Where are the namespaces?” They started shouting at me. They very well knew JavaScript and I never knew that there was anything called namespace in JavaScript! I started searching on the internet but couldn’t find any related information on JavaScript. From before, I always thought that JavaScript is a very simple language but I was 100% wrong. I always thought that very few people use JavaScript and never wanted to learn it because one of my college seniors said JavaScript is very simple language and he showed me the following program in JavaScript.

<script type="text/javascript">
function load()
alert(’Hello World..’);

<body onload="load()">


This used to show me Hello World when I used to open it in the browser. After that, I never bothered to learn more on JavaScript. But you can’t believe JavaScript is the most widely deployed application on the Internet!!! Can’t believe me?? I will tell you how…

Before that, please understand that JavaScript is nowhere related to Java language. The person who was developing JavaScript at netscape got inspired by Java so he used few tags from Java and then named it LiveScript but when they wanted to collaborate with Sun Microsystems, then they named it as JavaScript. I don’t want to discuss more on this. But just remember one thing that Javascript and Java are totally different. If you want to know more, here are the links… They say Javascript is the World’s Most Misunderstood Programming Language.. J ..

Every machine Windows, Mac, Linux has a web browser in it?? And every web browser has JavaScript in it. So JavaScript is the most widely deployed application in the internet. You can just code using HTML and JavaScript and there is no need to worry about deploying on client’s machine.

I will come back to my problem.. :-) .. After getting yelled at from my client, I started looking for more information on the internet. I asked the client to give me some time so that I can learn about JavaScript. I didn't find any good article on the internet about JavaScript which told anything about namespaces. I took complete 30 days to learn about JavaScript. I really got shocked when I got to know that we have inheritance, classes, etc. in JavaScript. At that time, I found that on Yahoo developers site, Douglas Crockford was doing a hell lot of things on JavaScript and I think he is a real genius. If anyone is interested in knowing more about JavaScipt, here is the link:

There are some 4 videos by Douglas Crockford — “The JavaScript Programming Language”.

Here you won’t find simple Hello World Stuff. :-)

Again back to my problem. I learned JavaScript and started coding for my client. Each UI control used to take hell lot of time for me as I was a beginner. As they were paying well enough, I thought I will buy controls from another company. There are some companies like infragistics[] where you can buy controls. But on Yahoo developers, you can find loads of free JavaScript stuff. So make sure you first look at it and then write your own or buy from others.

Somehow I managed to complete the project and delivered it. The same client again came to me and started asking me that he will be giving the demo of this application to his client and needs a good UI and said he will pay me for that. Then I said ok, I will look into it then I got to know that in Adobe Flash, we can do a lot of good UI stuff, animation, etc. I had very little time to deliver this, therefore started searching for a Flash designer. Then I found one who did his job well. He created a very nice UI with Menu Dropping from top and very good jazzy user interface. Then the biggest problem was waiting for me. How will I call events from Flash??? Damn…. There is something called action script in Java which will do that work. I failed to find an action script programmer. People who know Flash just know UI and animation they don’t know about action script. I struggled a lot to find one developer and get it done. Finally I ended up learning:

  • JavaScript
  • Flash
  • Action Script

All need different expertise and I got really very frustrated learning them. I know everything but I am not a master in any one of those. Take any of the above mentioned languages. They need more time and effort to get expertise in them. All I was doing was wasting time and money in outsourcing each and everything to another company and not giving the client a very good product.

Then I found out that Microsoft is coming with a product called Silverlight. They were very well aware about the problem developers were facing. They bundled everything into Silverlight. To make it simple to explain, Silverlight is nothing but a replacement for JavaScript, Flash (or any other UI dev kit), HTML. When I say replacement, I should also mention corresponding things which are replacing them so here is what I have listed:

  • HTML replaced by Silverlight
  • JavaScript replaced by C#
  • Flash replaced by WPF


I am a good ASP.NET programmer and I know C# well. So I can do client side coding in C# instead of JavaScript. Coooooool… That’s good.. Then Flash is replaced by WPF which is nothing but Windows Presentation Foundation which gives Drag and Drop like control in Visual Studio with Rich UI. And the code behind them is again C#. That’s awesome. And HTML is replaced by XAML silverlight which is nothing but a markup language like XML, but the only difference is TAGs are pre-defined unlike XML where we can have anything as TAG name. So I need to just concentrate on C# and XAML. I already know C# now I am left with XAML which is exactly like XML. Let me show you one sample XAML syntax.

<TextBox Name="txtBox" Text="Hello Silverlight!">


The above XAML code will create a TextBox with “Hello Silverlight!” written in its textbox. It’s so simple. Now I have a technology which is worth learning.

And that’s Silverlight. Now you might have got enough idea on Why Silverlight?

Now we can move to the relationship between WebBrowser, Webserver and Silverlight.

We will try to understand the relationship between web browser, web server and Silverlight.

  1. Web Browser
  2. Web Server
  3. HTTP Protocol

This post is dedicated to these.

1. Web Browser

Web browser is nothing but an application residing on the Operating system which will render the HTML.
Rendering means that it will know how to present the HTML Tags. It’s very important to know about working of web browser and most of the content here will talk about web browser and web server.

I will explain with one example.
When you type, you see my blog, but what is happening behind is what I am going to explain.

What web browser does the same thing we are going to do to it with telnet command.

  1. When you type -> what is happening is it’s connecting to web server on remote host and giving me the page back.
    Please note that web browser by default connects to port number 80.

    Now open command prompt. You can do that by going to Start -> Run and type the following:

    telnet 80

[ Note : Telnet Comes along with Windows. It’s a program which can be used to connect to any machine on any port. Like you want to connect to SMTP server of Google. Then use this command.telnet 25]

Figure 1.0 shows usage of telnet to connect to webserver [ Port 80 – Default ].

Figure 1

Once you are connected to the webserver, then you need to talk to the webserver in a language which it can understand and those are called protocols. Webserver supports mainly two protocols:

  1. GET
  2. POST


GET protocol is generally used to request for a page and POST protocol is used to post the data to the webserver. We will discuss the GET protocol.

What webserver expects is a string named GET followed by the page it want to fetch.

GET "page url"

So after connecting to webserver, you need to enter the following thing:


And mainly press Enter twice. That’s how the protocol is designed. That’s it. Now you will have the HTML code coming back from the server.

Figure 2

If you save all this data in a file with .html extension and open it in browser, you will see the same content which you will see when you visit

The entire HTML comes up to the client side as a DOM document needs to be replaced each time a new request goes to the server. Let me give one example. Suppose you want to delete one mail in your inbox. Then one new request will be sending it to the server and then the entire response HTML without that deleted mail should come back. Then we need to refresh the entire screen.

Then the new concept was added and that was AJAX (Asynchronous JavaScript + XML). You can read more on it here. This gave us the feature for modifying the DOM which was available at the Browser. So each time you delete a mail, an asynchronous request goes to the server and returns back with a flag and based on that, we change the DOM. This new feature which was implemented in the DOM was called Inner HTML property. This allowed us to make use of AJAX kind of calls.

Hope now we are clear with Web Browser and Web Server. Let’s move ahead and find out how Silverlight is working.

For Silverlight, Microsoft has developed a Plug-In which can be called as Light .NET CLR. This can be installed on the browser (currently it can be installed on Internet Explorer, Firefox, Chrome). The Plug-in is nothing but a stripped of version of the FAT .NET CLR.
You can use this to program in C#. You can make use of almost all basic data types which are present in .NET CLR.

Points of Interest

Microsoft is trying to put some lightweight CLR on the client side. I think it's kind of desktop application, but we are making use of web browser to put the necessary components in it.


  • 26th May, 2009: Initial post


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Software Developer
India India
Dhaneel Shanthpure has done his B.Tech in Computer Science and Engineering in 2007. He love working on web technology and challenging project. Currently he is working on Silverlight,WCF,C#,ASP.Net and PHP. He also got interest and developed few application in Open Social and PHP.He writes his blog at
Any questions, comments or suggestions are always welcomed at

You may also be interested in...

Comments and Discussions

GeneralMy vote of 1 Pin
Waldir Pimenta13-Nov-12 14:36
memberWaldir Pimenta13-Nov-12 14:36 
GeneralNice Introduction Pin
mramakrishnan25-Jun-10 11:58
membermramakrishnan25-Jun-10 11:58 
GeneralMy vote of 1 Pin
Michael Sync23-Jul-09 6:52
memberMichael Sync23-Jul-09 6:52 
Generalgood one [modified] Pin
rameshisin20-Jul-09 22:03
memberrameshisin20-Jul-09 22:03 
GeneralThank you for writing this article... Pin
thomasjamo4-Jun-09 16:58
memberthomasjamo4-Jun-09 16:58 
GeneralThanks Pin
thejonz2-Jun-09 13:34
memberthejonz2-Jun-09 13:34 
GeneralDecent Article (get a clue you '1 vote from me' folk) Pin
Gary Noter2-Jun-09 8:43
memberGary Noter2-Jun-09 8:43 
GeneralRe: Decent Article (get a clue you '1 vote from me' folk) Pin
dhaneel2-Jun-09 18:18
memberdhaneel2-Jun-09 18:18 
GeneralNice Introduction. Pin
bob40962-Jun-09 8:07
memberbob40962-Jun-09 8:07 
GeneralGreat article, I like it Pin
Seraph_summer2-Jun-09 5:37
memberSeraph_summer2-Jun-09 5:37 
General[My vote of 1] Title of the article is not very helpful Pin
varnk2-Jun-09 3:56
membervarnk2-Jun-09 3:56 
GeneralNice Pin
GerhardKreuzer2-Jun-09 3:53
memberGerhardKreuzer2-Jun-09 3:53 
GeneralMy vote of 1 Pin
Onskee127-May-09 7:19
memberOnskee127-May-09 7:19 
GeneralYup, this is... Pin
Dewey26-May-09 22:19
memberDewey26-May-09 22:19 
GeneralThanks for introducing SilverLight Pin
yarp26-May-09 21:09
memberyarp26-May-09 21:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.171207.1 | Last Updated 26 May 2009
Article Copyright 2009 by dhaneel
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid