CODEDIGEST
Home » Articles
Search
 

Technologies
 

Sponsored links
 

CodeDigest Navigation
 

Technology News
No News Feeds available at this time.
 

Community News
No News Feeds available at this time.
 
Beginning Silverlight Development

By Gaurav Arora
Posted On Apr 20,2009
Article Rating:
Average Rating: 2
No of Ratings: 1
No of Comments: 6
Category: Silverlight
Print this article.

Beginning Silverlight Development

 

Introduction

Microsoft introduced Rich Internet Application with the introduction of Silverlight which is a very lightweight and a client-side application.

 

Scope of article

The scope of article is just to elaborate “What is Silverlight?” The advance topics like implementation details, etc is not covered or in the scope of this article.

 

Definition

In simple words, Silverlight is a client-framework having cross-browser, cross-platform ability developed by Microsoft, which provides Designers and developers to develop Rich Internet Applications [RIA] to embed into web applications.

Silverlight Framework

Silverlight Framework is a combination of following three very different architectures,

 

1.      Browser-plug-in

It provides the necessary interaction with the browser enabling the same Silverlight application to run on multiple platforms The plug-in must be installed by the user before Silverlight applications can be viewed in the browser.

2.      Presentation framework

3.      .Net Framework

These provide Silverlight to bridge the gap between UI and interactive language.

 

As Silverlight applications are run as Client-Side applications so there is no need to refresh the page /UI. Using Silverlight’s implementation of the .NET framework, developers can easily integrate existing libraries and code into Silverlight applications.

 

Presentation of Silverlight is a sub-set of Windows Presentation Foundation [WPF] which is based on the eXtensible Application Markup Language (XAML) programming language. The XAML language is simply based on the XML language with application elements that map to objects and properties in the .NET framework. Because it is based on the XML language format it can be easily parsed and integrated with many technologies.

 

Silverlight’s implementation of WPF provides a rich set of controls such as buttons, calendars, text boxes, scroll viewers, a data grid, and much more. These controls are easy to implement in the XAML language as well as easy to access from .NET managed code.

Silverlight’s media pipeline makes it simple to stream media such as WMV, MP3, and JPEG files to your application UI. This allows you to add rich UI elements that can give users a true Web experience.

 

Importance or why we use Silverlight?

1.      It’s a cross-browser and cross-platform technology so, it provides rich experience at client-side.

2.      Plug-in is installed in few seconds.

3.      It run as a client-side application so there is no need to refresh UI.

4.      Empowering of rich videos, and audios.

 

Code-Breaking Changes

 

There are many code breaking changes since the first release of Silverlight so, I advice to visit,

 Code Breaking Changes – Silverlight for further enhancement.

 

Architectural View of Silverlight Framework

 

The Silverlight framework allows applications to access Web services, databases,

Web servers and other data sources. It also allows the application to integrate with the Web page DOM as well as AJAX and JavaScript to enhance the functionality of the Web page.

 

Following is the architectural view of Framework.

 




How to Set the Development Environment?

To go with the following I advice you to go first with following link: http://www.silverlight.net/GetStarted

 

Following are the steps to set up the Environment,

1.      Install Visual Studio 2008 with Visual Web Developer Feature.

2.      Install SilverLight Plug-in: download Silverlight Plug-in from http://www.microsoft.com/silverlight   and Install Silverlight2, make sure you have uninstalled all previous versions of Silverlight.

 

How to Install Silverlight SDK

 

Go to, http://www.silverlight.net/GetStarted

 

Installation of Silverlight SDK depends upon your environment, like if you have Visual Studio 2008 installed or not on your computer.

 

If you have VS2008 Installed

Install Silverlight for Visual Studio from the above link which installs following(s):

Ø       Silverlight 2 plug-in

Ø       Silverlight SDK

Ø       Visual Basic and C# Templates

Ø       Code generators for XAML

Ø       Debugging for Silverlight application

Ø       Integration with expression Blend.

 

If you have not ‘VS2008’ Installed

To download an install go with the following(s):

Ø       Click on install

Ø       Review the requirements

Ø       Download and save the file in your local system.

Ø       Now double click the downloaded file

 

Steps to start your First Silverlight application

Following are the initial steps to give the overview to just start first application:

 

Ø       Select File -> New -> Project from Main Menu of Visual Studio

Ø       Select C# / Visual Basic from the project types

Ø       From Template list select Silverlight Template.

Ø       Enter project name and location then create a new project.

Ø       To host Silverlight within the project, select generate HTML test page.

Ø       Finally click ok.

Ø       The page.xaml appears

Ø       From toolbox drag and drop any control on the page.

Ø       Modify the control and then save  the page.xaml file.

Ø       To get into code-behind double click on the control

Ø       Write some test message: Like “Hello I am started!”

Ø       Now build and test the changes.

 

 

Code in Page.xaml:

 

<UserControl x:Class="myFirstSilverlightApp.Page"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    Width="400" Height="300">

    <Grid x:Name="LayoutRoot" Background="White">

        <Button x:Name="myButton" Canvas.Top="75"

                Canvas.Left="150" Content="Click Me"

                Height="37" Width="118" Click="myButton_Click"

                ToolTipService.ToolTip ="Click to change above text"/>

    </Grid>

 

</UserControl>

 

Code in Page.xaml.cs:

 

using System;

using System.Collections.Generic;

using System.Linq;

using System.Net;

using System.Windows;

using System.Windows.Controls;

using System.Windows.Documents;

using System.Windows.Input;

using System.Windows.Media;

using System.Windows.Media.Animation;

using System.Windows.Shapes;

 

namespace myFirstSilverlightApp

{

    public partial class Page : UserControl

    {

        public Page()

        {

            InitializeComponent();

        }

 

        private void myButton_Click(object sender, RoutedEventArgs e)

        {

            myButton.Content = "Hello I am started!";

        }

 

    }

}

 

Following is the output of the application:

 

Conclusion

In sum up, now we have idea about the Silverlight and its architecture. We have gone through the installation and start-up of a Silverlight application. Believe me it’s all easy and fun.

 

We will discuss advance controls in coming articles.

Similar Articles
You can contribute to CodeDiget.Com:
Donate to CodeDigest.com
Article Feedback
Comments
Your website has to
Your website has to be the <a href="http://ugoecjchz.com">eliecrontc</a> Swiss army knife for this topic.
Yeah, that's the tit
Yeah, that's the titcke, sir or ma'am http://wamwpcvg.com [url=http://eyrjybhwxm.com]eyrjybhwxm[/url] [link=http://wdazoitxaz.com]wdazoitxaz[/link]
I don't know who you
I don't know who you wrote this for but you helped a <a href="http://vnjbemonion.com">brhteor</a> out.
You got to push it-t
You got to push it-this esntesial info that is!
To Joe
Hi Joe,

I am extremely sorry to creating confusion.
Actually you can install Silverlight in two flavors:
1. For VS2008 you need to install only SDK
2. If you haven't VS2008 or any other IDE which supports SIlverlight , then you have to install Silverlight with complete pack from second link as said in above article.

Hope, it will clarify all above confusion.

Please revert back for any further assistant.
????
Hi Gaurav,

I could'nt reach anywhere by following your step in setting my dev environment.

What you really mean by "If you have VS2008 Installed" and "If you have not ‘VS2008’ Installed"? You want me to do silverlight development without VS 2008 installed?

In the section, "If you have VS2008 Installed" you have said, "Install Silverlight for Visual Studio from the above link which installs following(s)", Do these items needs will be installed from http://www.silverlight.net/GetStarted ? If so, you have asked to install silverlight plugin from http://www.microsoft.com/silverlight. This means that silverlight plugin will again installed from http://www.silverlight.net/GetStarted ?

To add more confusion, in section "If you have not ‘VS2008’ Installed", your 1st point says to click install..but am totally lost here, where should i click install?

If you want to really help people then please take care on what you are writting..