Pages

Wednesday 30 November 2011

Lesson 1. Beginning Silverlight Development

Hi and welcome to the first lesson of Silverlight Development . We will use the " Learn by Example " approach for most of our lessons here, and that should keep things interesting :)


Silverlight can be used for creating visually appealing web interfaces .  In short, you can create awesome websites and web applications  with a little effort. We'll discuss the advantages, utilities and benefits of  Silverlight as me move along the lessons. 



For now, we will be looking at the following concepts  in this lesson.

1)   Tools for Silverlight Development.
2)   Exploring Interface and Controls
3)   Creating your first application in Silverlight
4)   Basic Event handling 


You'll need to have these Tools for silverlight development:

1)  Visual Studio { i am going to use Visual Studio 2010}
2)  Silverlight tools for Visual Studio.
3)  Microsoft Expression Blend.
4) Any browser of your choice , with the silverlight plugin installed.

Note:  Expression Blend is not mandatory, but it greatly simplifies your application development.

Step 1:  Creating the Project 

1)  Open Visual Studio and go to New Project



2)  Select Project type as Silverlight
3)  Select New Silverlight Application
4) Type the Application name


5) Just press Ok and proceed.



6) You will be presented with the User Interface for the newly created application.
    Double Click on MainPage.xaml in the Solution Explorer to the right of the screen.


If you observe closely at the lower part of left hand side, you will find two "Views" available. One is the Design view and the other is the XAML view .

Design view  displays the elements visually, where you can drag and edit the controls using your mouse.

Xaml view makes it possible to edit the controls like buttons, text boxes etc  with simple code.
(We will see more about XAML in the coming lessons.)



Step 2:  Exploring the controls 

1) To the extreme left of  your project, you will find a Toolbox, that contains various controls.
    
 
2) We can drag those controls onto our design mode and move them around



3)  We can change the properties of the controls by right clicking and pressing Properties.




4) Similarly  you can add any control and change its properties.

Step 3 :   Event Handling

1)  Select the button. Now, in the properties window, you will find a lighting symbol , which denotes events.


2)  Double click on the Click event in the Properties window.  It will open a code file.

 
3)  In the button1_click event,  type  MessageBox.Show("I am learning Silverlight");


4) Press F5  to run the program.  Now click on the button to see output.


I have explored more controls in a  video . Please view the  detailed tutorial video here