SILVERLIGHT
DIVYA . E
MCA – II Year
Silver Light
• What is Silver Light ?
• Releases of Silver Light
• Features and Advantages
• Working of Silver Light in ASP.NET Application
• Advantage and Disadvantage
Silver Light
• What is SilverLight :
▪ SilverLight is a new Microsoft Technology on the web
platform for Rich Internet Application (RIA)
▪ It was launched by Microsoft in 2007 (first version
release).
▪ It was advanced to .NET Application embedded in the .NET
through the current Technology.
▪ It is also called as Cross – Browser Technology.
Silver Light
• Silver Light is a browser plug in which was
approximately 4MB in size.
• It is a client side free software for easy and fast access.
• Silver Light Application are delivered to a browser in a
Text-Based Markup Language called XAML.
• Example : Firefox (Browser) , Windows (OS).
Major GOAL :
SilverLight was developed with the goal to fill the
gap between windows application and web application.
SilverLight
• Silverlight Releases:
The following are the versions of SilverLight:
SilverLight 1.0
▪ It was released in 2007 by Microsoft.
▪ It was called as WPF/E, which stands for Windows
Presentation Foundation/Everywhere.
▪ This Release consists of
▪ Core Presentation Framework, which is responsible for UI,
interactivity and user input, graphics animation and DOM
Integration .
SilverLight 1.0
• Here in this version,
• It starts by invoking the SilverLight control from html page,
• then loads Up a XAML file .
▪ XAML file contains a canvas object which acts as placeholder for
other elements.
▪ It provides various geometrical primitives like line, text , shapes and
images etc…
SilverLight
• Drawback :
▪ Does not Support managed code (ie , we can use .NET
supported languages managed by a scripting language).
▪ But,it was hard for non script languages.
To Overcome this, SilverLight 2.0 was released.
• SilverLight 2.0
• It was released in March 2008.
• It supports .NET programming languages like c#, VB.NET to
manipulate UI elements at client side.
• This version is based on Microsoft .NET Framework 3.5
SilverLight
• Here You can have a code
behind file for every XAML
Pages to handle.
ADVANTAGE :
▪ Silver Light has its own
Library , which is a subset of .NET Framework base class
library that includes controls , web service, components
and API features .
SilverLight
• Features :
o Rich Base Class Library.
o Powerful built-in controls.
o Better Security.
o Cross-platform and Cross-Browser support.
• Then the Silverlight version are extended as
Silverlight 3.0 and Silverlight 4.0 beta.
• Let us now see how SilverLight works with ASP
.NET Web Applications.
SilverLight
• SilverLight Associates with XAML
• XAML
❑ It is also an XML file that has the .xaml extension
and then separate UI definition from the run time logic
by using code behind files.
❑ XAML file has a set of rules (XML rule) that map
with object elements into class, structure, attributes
and events .
❑ XAML elements map to Microsoft .NET types as
defined assemblies and members .
SilverLight in Asp.NET
• Step 1 − Open Visual Studio. Click the File menu, point
to New and then click Project.
SilverLight in Asp.NET
• Step 2 − A New Project dialog box will open. • Step 3 − Check the Host the Silverlight
Under Templates, select Visual C# and application checkbox. The default is an
then click Silverlight. In the right pane, ASP.NET Web Application Project.
choose Silverlight Application.
SilverLight in Asp.NET
• Step 4 − MS-Visual Studio has created two projects,
• One is a Silverlight project and the other is an ASP.NET web application.
• Now, we do need an ASP.NET web application.
• You can see this in the Solution Explorer window as shown below.
SilverLight in Asp.NET
• Step 5− Given below is a simple code in MainPage.xaml in which
a Button and a TextBlock are defined inside the StackPanel.
Code: ( MainPage.xaml )
<User Control x:Class = "FirstExample.MainPage"
xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x = "http://schemas.microsoft.com/ winfx/2006/xaml"
xmlns:d ="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc = "http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable = "d" d:DesignHeight = "300" d:DesignWidth = "400">
<Grid x:Name = "LayoutRoot" Background = "White">
<StackPanel> <TextBlock x:Name = "TextMessage" Text = "Hello World!" Margin =
"5"> </TextBlock> continue….
SilverLight in Asp.NET
Code :( MainPage.xaml )
<Button x:Name = "ClickMe" Click = "ClickMe_Click" Content = "Click
Me!" Margin = "5">
</Button>
</Stack Panel>
</Grid>
</User Control>
▪ The page MainPage.xaml
Looks like >>>
SilverLight in Asp.NET
• Step 6 − This example assumes that you have created an event-handling method
named ClickMe_Click. Here is what it looks like in the MainPage.xaml.cs file.
• Code (MainPage.xaml.cs )
using System. Windows;
using System.Windows.Controls;
namespace First Example {
public partial class Main Page : UserControl {
public Main Page() {
Initialize Component(); }
private void ClickMe_Click(object sender, RoutedEventArgs e) { TextMessage.Text
= "Congratulations! you have created your first Silverlight Application";
}
}}
SilverLight in Asp.NET
• Step 7 :When we run the file on browser, the Output is as
follows,
SilverLight in Asp.NET
• Step 8 − Now, when you click the Click Me button, it will update the text in
the TextBlock as
This is how the Silverlight works in ASP.NET Web Application
SilverLight
• Advantages • Disadvantages
❖ Execute .NET code ❖ You cannot have a
without deploying the general style for buttons .
.NET run time. ❖ Web cannot be indexed
❖ Supports Moonlight, an by Google .
official Open Source of
Silverlight.
❖ Isolated Storage for
Local File Access .
THANK YOU
HAVE A NICE DAY