Silverlight FAQ – 13 Questions for Beginners
Posted by: Mahesh Sabnis
in Category Silverlight 2, 3, 4 and 5
Abstract: This article contains a Silverlight FAQ (Frequently asked questions) to help those who are new to Silverlight or plan to get started with Silverlight.
As a trainer, I conduct lots of trainings on WCF, WPF and Silverlight and most of the times, my participants, especially those coming from an ASP.NET background, ask me some common questions on why and when to use Silverlight. Though there are various web sites which provide information about Silverlight including the official Silverlight site and my articles on DotNetCurry, I still face these queries on a regular basis. I finally thought of writing a General Silverlight FAQ to help those who are new to Silverlight or plan to get started with Silverlight.
Once you have read the FAQ, you can read some Silverlight Articles here to see how to use it in your applications.
Q1. What is Silverlight?
- Silverlight is a powerful technology used to build rich browser, desktop and mobile user experience (UX) applications with the support for Media, multithreading, data binding, 2-D and 3-D graphics. Powered by the .NET framework, Silveright is a free plug-in and compatible with multiple browsers, devices and operating systems
- It has its own CLR (coreclr.dll) and exists as a browser plug-In (npctrl.dll).
- For Silverlight development, you can either install Silverlight using the Web Platform Installer or use Silverlight 4 Tools for Visual Studio 2010.
- The latest version is Silverlight 4.0 and a plan has been laid out for Silverlight 5.0
Q2. Is Silverlight a replacement for ASP.NET?
Absolutely not. ASP.NET provides its own power of server side programming, with more enhanced security. Silverlight plugin executes inside the browser sandbox (client side) and needs to be configured explicitly for security using WCF services for authorization and authentication. A mix of ASP.NET and Silverlight is used in most applications.
Q3. Can we develop Client-server applications or Intranet applications using Silverlight?
This totally depends on the architecture and application requirements. One important thing to note here is that Silverlight applications cannot ‘directly’ connect to the database server. So thinking of a client-server application development using Silverlight might require some thinking on your part. WindowsForm or WPF can be a good choice in this scenario.
Q4. What type of applications can be developed using Silverlight?
You can think of developing browser or mobile applications using Silverlight, where you need to represent output in a graphical form, a rich UX. For E.g. In case of a healthcare application, you can think of using Silverlight for simulating ECG of the patient, as shown below:
The above output makes use of Polyline 2-D graphical element of Silverlight. Likewise various types of Line-of-Business (LOB) applications, for various domains can be developed. Some example are :
and any other domains you can think of.
Q5. How then the data be made available to Silverlight applications?
- For developing Line-Of-Business (LOB) applications, Silverlight supports Data-Binding features with OneWay, TwoWay binding mechanism.
- Using Windows Communication Foundation (WCF), data from the remote server can be made available to Silverlight applications.
- The communication between Silverlight and WCF service is possible using ‘basicHttpBinding’. This is the binding provided in WCF service for HTTP protocol with plain text communication from Silverlight to WCF.
Q6. What types of security measures are provided with Silverlight?
- For secure communication, Silverlight makes use of WCF service and uses the security features of WCF.
- You can also make use of Secure Socket Layer (SSL) transport security mechanism from Silverlight to WCF.
Q7. Can the Silverlight application be deployed on the desktop?
- Yes, Absolutely possible. With Silverlight 3.0 version and onwards, the Out-Of-Browser (OOB) facility has been provided. Using this feature, the Silverlight application can be physically deployed on local machine.
- In Silverlight 4.0 the OOB facility has been enhanced with elevated rights, which allows a Silverlight application to do the following:
-Communicate with Word, Excel type applications by using COM enhancements, provided in Silverlight 4.0.
-Communicate with local database e.g. MS-Access, Sql Server etc.
Q8. Where is the Silverlight application present, is it on the Web server or on the Client?
- The Silverlight application in most cases is hosted in an ASP.NET webpage, although it can be hosted on HTML pages too. The extension of the SL plugin is .xap.
- When the end-user makes an HTTP request to this ASP.NET page (.aspx), the Silverlight application is made available to the browser and the result is displayed.
Q9. What are the controls provided in Silverlight for Line-of-Business (LOB) applications?
You can make use of following controls:
- Chart controls etc.
Q10. Can the Silverlight application communicate with ASP.NET?
This can be possible using:
Q11. What is the real advantage of using Excel/Word files or local database in Silverlight?
- This can be required when the end-user is using Silverlight application in OOB (Out-Of-Browser) and for storing and fetching the frequently required data, instead of relying on WCF service for data communication, the data can be fetched and stored in Excel sheet on the local database
- In case of the Excel/Word files communication, they are recommended to be stored in ‘MyDocuments’ special folder.
Check my article Reading Excel File in Silverlight 4.0 - COM Programming to know more.
Q12.What are the advantages of Extensible Application Markup Language (XAML) over C# or VB.NET
- One important thing note here is that C#/VB.NET (code-behind files) have their own important roles to play.
- XAML provides lots of features like code-less development, creating complex UI controls E.g. creating image list by using ListBox and Image control used together.
- The XAML file can define an instance of the class created using C# and VB.NET and all public properties declared in this class can be directly bound in XAML elements.
Q13. Can we use any specific Patterns in Silverlight programming?
- Yes. In Silverlight, Model-View-View-Model (MVVM) can be used for loosely coupled application development where code can be completed isolated from the XAML.
- We can also use Prism in Silverlight which is a set of classes provided for developing next generation loosely coupled, flexible LOB applications.
Check my article Line of Business (LOB) Application using Silverlight 4, WCF 4, EF 4 and Commanding Architecture
This article has been editorially reviewed by Suprotim Agarwal.
C# and .NET have been around for a very long time, but their constant growth means there’s always more to learn.
We at DotNetCurry are very excited to announce the The Absolutely Awesome Book on C# and .NET. This is a 500 pages concise technical eBook available in PDF, ePub (iPad), and Mobi (Kindle).
Organized around concepts, this eBook aims to provide a concise, yet solid foundation in C# and .NET, covering C# 6.0, C# 7.0 and .NET Core, with chapters on .NET Standard and the upcoming C# 8.0 too. Use these concepts to deepen your existing knowledge of C# and .NET, to have a solid grasp of the latest in C# and .NET OR to crack your next .NET Interview.
Click here to Explore the Table of Contents or Download Sample Chapters!