ASP.NET,C#.NET,VB.NET,JQuery,JavaScript,Gridview,SQL Server,Ajax,jQuery Plugins,jQuery UI,SSRS,XML,HTML,jQuery demos,code snippet examples.

Breaking News

  1. Home
  2. Silverlight
  3. Microsoft Silverlight

Microsoft Silverlight

Microsoft Silverlight is a technology for developing and running rich Internet applications. Its functinalities and purposes is similar to Adobe Flash.This article will be very helpful for those who want to learn or start working on Silverlight. This is a good Beginner’s Guide to Silverlight. This article explained an introduction of Silverlight or Silverlight basics. Summary of the article:
  • What is Silverlight?
  • History or Version
  • Why Silverlight?
  • What is XAML?
  • What is App.xaml file?
  • What is MainPage.xaml file?

What is Silverlight?
Silverlight is a powerful technology for creating and delivering Rich Internet Applications (RIA) and media experiences on the Web. It is developed by Microsoft Corporation in 2007. Silverlight applications are delivered to a browser in a text-based markup language called XAML. It is considered as a competitor to Adobe’s Flash.
On other hand we can say Silverlight is a free web-browser plug-in that enables interactive media experiences, rich business applications and immersive mobile apps.
It supports Multiple Browser System or Cross-Browser Technology (such as Internet Explorer, Firefox and Safari, Opera etc) and Multiple Operating Systems or Cross-Platform Technology (such as Windows, Mac, and Linux). It also supports multi devices or Cross-Device Technology which includes mobile devices to desktop browsers to 720p HDTV video modes etc.
Silverlight technology is the compressed of four parts:
  1. Silverlight Plug-in: – the engine that renders the Silverlight application in the browser.
  2. Silverlight Host, The Web Page: – the web page where Silverlight Application is hosted.
  3. Silverlight Application File (.XAP):- the Internet Application which is developed using Microsoft Visual Studio and Expression Blend.
  4. Extensible Application Markup Language (XAML), The Interface language:- a declarative programming language used to create rich vector graphics and animations.
History or Version
Here is the some short description of History or Version of Microsoft Silverlight.
  1. Silverlight 1 -It was released in 2007.
  2. Silverlight 2 -It was released in 2008.
  3. Silverlight 3 -It was released in September 12, 2008
  4. Silverlight 4 -It was released in November 18, 2009
  5. Silverlight 5 -It was released in December 9, 2011
Why Silverlight?
Why we should use Silverlight over Flash and other technologies or list of advantages of:
  • It support .NET framework – if we know .NET then we can easily start programming on Silverlight.
  • It supports C#, VB.NET, LINQ, dynamic languages (IronPython, IronRuby).
  • It support better development tools such Visual Studio 2010, Expression Blend.
  • Lot of tutorials is available as compared to Flash.
What is XAML?
Extensible Application Markup Language or XAML is a XML file which is a declarative programming language used to create rich vector graphics and animations. This XAML file generally rendered by the Silverlight plug in and displayed inside the browser window. When we compile our Silverlight Application at first it is converted into BAML (Binary Application Markup Language) and then rendered in the web browser window.
What is App.xaml file?
App.xaml file is the loader of Silverlight Application. We can declare our shared/global resources, styles, templates, different brushes inside this file which will be accessible by the others files of the application.
A sample App.xaml file is like this:
<Application
x:Class=”Silverlight.App”
xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation”
xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml”>
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source=”Assets/Styles.xaml”/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
It has a code behind file also and it’s named its App.xaml.cs. This file is used to handle global application level events which we can use it according to our requirements. Generally Visual Studio creates these two files at the time of project creation. The three events inside the App.xaml.cs are:
  • Application_Startup
  • Application_Exit
  • Application_UnhandledException.
Sample code for App.xaml.cs file is like:
App()
public App()
{
this.Startup += this.Application_Startup;
this.UnhandledException += this.Application_UnhandledException;
InitializeComponent();
}
Application_Startup
private void Application_Startup(object sender, StartupEventArgs e)
{
this.RootVisual = new MainPage();
}
Application_UnhandledException
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
// If the app is running outside of the debugger then report the exception using
// a ChildWindow control.
if (!System.Diagnostics.Debugger.IsAttached)
{
// NOTE: This will allow the application to continue running after an exception has been thrown
// but not handled.
// For production applications this error handling should be replaced with something that will
// report the error to the website and stop the application.
e.Handled = true;
ChildWindow errorWin = new ErrorWindow(e.ExceptionObject);
errorWin.Show();
}
What is MainPage.xaml file?
When we create a Silverlight project, Visual Studio automatically create a default MainPage.xaml file which is actually a start page for Silverlight application. We can modify it according to our requirements or we can create a new one.

No comments