Silverlight Interview Questions and Answers

Silverlight Interview Questions:

What is the difference between WPF and Silverlight?
Can you name some of the built-in layout panels you have used in Silverlight?
What is Storyboard?
How to perform Eventhandling in Silverlight?
Can we add a reference to a Class library project in Silverlight application project?
What is the use of Silverlight.js file?
When you create a new project in Silverlight through Visual Studio, how many xaml files are created and what are the uses of those files?
Which programming languages can be used to write Silverlight application?
What does XAP mean?
What is a .xap file?
What is the use of ClientBin folder?
What is the parent xaml tag of Silverlight page?
How will you change the default page of the Silverlight application?
Which language is used to design the layout in Silverlight?
How to set Silverlight contents width as 100%?
Name some of the Layout Management Panels and when you will use them?
Does Silverlight Project support ADO.Net?

What kind of audio video formats are supported in Silverlight?
Silverlight supports Windows Media Audio and Video (WMA, WMV7-9) and VC-1, as well as MP3 audio.

How many ways you can display text using Silverlight?
Silverlight supports displaying static pre formatted text that is comprised out of glyph elements and also dynamic text that uses TextBlock. With glyphs, one needs to position the characters individually while TextBlock supports simple layout.

How does XAP work in silverlight?
Once you have created the .xap file (explained below), the Silverlight 2 or 3 plug-in downloads the file and runs it in a separate work space.

How do I use a .xap file in silverlight?
A .xap file is used to contain and transfer the assemblies and resources of a managed code application. This managed code application must be run within the Silverlight 2 browser plug-in.

What are the files contained in the .xap file in Silverlight?
A basic xap file in silverlight will have an assembly related to specific code for the application, an application manifest file and any additional assemblies need to run the application. At a minimum, two files are needed, the application manifest file and the application assembly.

For example:

AppManifest.xaml

MyPianoV2.dll

What is contained in the AppManifest.xaml file in silverlight?
The AppManifest.xaml file contains the deployment details needed to run the silverlight application.

What is the XAP mime type in silverlight?
The .xap mime type is: application/x-silverlight

Which platforms and browsers will Silverlight 2 supports?
Silverlight will support all major browsers on both Mac OS X and on Windows. Particular care is being taken to account for differences in platform and browser capabilities to ensure a consistent experience including experiences on Firefox, Safari, and Internet Explorer. Microsoft will extend the support for Silverlight on Linux through a partnership with Novell.

What is the difference between Silverlight 1 and Silverlight 2
Nothing, Silverlight 2 is a full superset of Silverlight 1.0 - it is 100% compatible with Silverlight 1.0 applications and provides significantly more powerful features and functionality. Silverlight 1.0 applications even benefit from improvements in media playback and performance characteristics of Silverlight 2 with no additional work.

What is Storyboard in Silverlight?
Storyboard is a Silverlight class with controls animations with a timeline, and provides object and property targeting information for its child animations

What is the difference between WPF and Silverlight?
Silverlight uses a particular implementation of a XAML parser, with that parser being part of the Silverlight core install. In some cases, the parsing behavior differs from the parsing behavior in Windows Presentation Foundation (WPF), which also has a particular implementation

What is Silverlight Tool Kit?
To create an application or game you need to design, code and give some extra feature to your output.

To do the above, you need some controls, IDE etc.

Silverlight Tool kit is nothing but is a collection of Silverlight Tools, Components etc. It includes source code describing the all you need to develop an application.

Please visit this link for more info:http://www.codeplex.com/Silverlight
Can I add more than one .xaml pages in silverlight application?
Yes, you can have multiple .xaml files in a single project.

In the App.xaml, in the method Application_Startup you can choose, which page you want to

initially display.

How does Silverlight 2 differ from Adobe Flash?
As I am from .Net background so in my views you can get C# / Vb.net compiled code but in Flash there is only action script.
You can find difference in depth at : http://silverlight.net/forums/t/3015.aspx

What happened when I press F5 within Visual Studio to run Silverlight application?
When you run the Silverlight application within Visual Studio, a new folder created in the web-site project for silverlight solution and it happened only first time. The folder name is ClientBin and having package with XAP extension which contains compiled project.

Can you elaborate how to start a silverlight application with Visual Studio?
You can find a fully described article from http://www.silverlightclub.com/resources/1858-silverlight-lets-start-bui...
In the following step(s) I am giving the ideas all about:
1.Create a project:Here you just start your visual studio, Select your programming language [C#/VB], Choose Silverligh Template give the name and save it
2. Adding SIlverlight COntrols:One thing is happened here, controls cannot dragged onto the designer, you can draw/drag the controls on XAML page.
(a) Naming to control:In this step just give the name to your silverligt control like for Button you can give name as : btnmySilverligtButton
(b)Adding event handlers to Silverlight controls:Here you can give the event handlers like for click etc.
(c)Testing Silverlight applications in Visual Studio:Now just press F5 and test your application

What is the best place to start Silverlight application?
There is no hard and fast rule to start Silverlight application. Every developer can start as per his/her experience.
like as per my case I always prefer Visual Studio. SO, in my view Visual Studio is the best place to start with Silverlight2 applications.Microsoft provides
templates for creating Silverlight applications and libraries in C#
and Visual Basic.

More Questions
What is namescope?
In Silverlight, a XAML namescope stores relationships between the XAML-defined names of objects and their instance equivalents. This is similar to the wider meaning of the term "namescope" in other programming languages and technologies. XAML namescopes are created while parsing a XAML source and creating an object representation. The names in a XAML namescope are then used by code-behind operations at run time to access the objects that were created by parsing the XAML.

Read more on Namescope here...
http://msdn.microsoft.com/en-us/library/cc189026%28VS.95%29.aspx

What should I remember when using XamlReader to create objects dynamically?

  •     You must be careful with the namescope issue.
  •     The root element in the XAML snip must have the default xml namespace: xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation.
  •      If you need to define x:Name, the root element in the XAML snip must have the xml namespace: xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml.
  •      XamlReader.Load doesn’t support defining event handlers in markup. To add event handlers, use FindName to find the desired element and add event handlers in code.
  •      Using XamlReader is not recommended.  .Load simply for creating objects dynamically in code. Use it only for serialize/deserialize purposes. To create objects dynamically, call their constructors. To create reusable components, write UserControls.

What is the cross domain/scheme/zone policy? How do I configure it?
How do I provide a cross domain policy file for a self-host WCF service?
How do I call a web service without a proxy?
What are the restrictions of web service accessing in Silverlight 2?
What graphic related features are supported in Silverlight 2?
How do I create 3D effect?
What do I do when my Silverlight application seems to leak memory?
What are the restrictions on mini CLR?
What data binding features of WPF are not yet supported in Silverlight? Is there a workaround?
How do I bind to flexible (untyped) data sources?
What is the socket accessing policy? How do I create a socket policy server?
Html and ASP.NET integration:
How do I use InitParams?
What do I need to configure on the web server? What to do if a third party server is not configured properly?
What is the relationship and difference between Silverlight and ASP.NET? When should I use either?
How do I create animation without Storyboard?
How do I create a Storyboard and apply it to multiple elements?
What’s the difference between animation in Flash and Silverlight?
What media types are supported in Silverlight 2?
How do I modify the media player generated by Expression Encoder 2?
How do I open and play a local media file?
What should I remember regarding routed events?
What offline capabilities does Silverlight support?
Does Silverlight support web camera and printing?