Home Interview Questions and Answers Silverlight Interview Questions and Answers Part-1

silverlight1. What is XAML ?

Extensible Application Markup Language (XAML, pronounced zammel) is a declarative XML-based language created by Microsoft which is used to initialize structured values and objects.

2. 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.

3. Can you name built-in layout panels you have been using with Silverlight?
You are looking for Canvas, StackPanel and Grid

4. What is Storyboard?
Storyboard is a Silverlight class with controls animations with a timeline, and provides object and property targeting information for its child animations
Given XAML below
<Ellipse x:Name=”ellipseTest” Height=”20″ Width=”20″ Canvas.Left=”0″ Canvas.Top=”10″ />

5. How can you set image Source dynamically from C# application to” test.png” file?
Surprisingly it is not as straight forward as it might sound, but anyone who seriously worked with Silverlight should be easily answer it.

One of the ways is:
img.Source = new BitmapImage(new Uri(“test.png”, UriKind.Relative));

Given XAML below
< Rectangle x:Name=”test” Height=”20″ Width=”20″ Canvas.Left=”0″ Canvas.Top=”10″ />

6. How to perform Event handling in silver light?.
Silverlight 1.0 uses JavaScript, while Silverlight 2.0 uses C# (managed code) for event handling. We will be describing the event model for Silverlight 2.0.
The event handlers are defined in the code-behind file that backs the XAML definition of your User Interface (UI), namely mypage.xaml.cs.

The Silverlight Event Mode
In Silverlight, there are two event cases:
1- Input events
2- Non-input events.
Input Events: The browser that hosts the Silverlight plug-in handles initial input stimulus for the input events. This is because Silverlight works within the plug-in architecture of the hosting browser. From the browser, the event is sent to the Silverlight plug-in.
Then, it is raised as an event in the Silverlight Object Model.

Non-input Events: They report a state change to a particular object, for example, the state change events that report asynchronous download state or progress of actions initiated by Web Client. Some non-input events provide lifetime information of objects at a framework level.
For example the FrameworkElement.Loaded event.
Some events, such as OnError, can only be handled by the Silverlight plug-in instance and exist within the HTML Document Object Model (DOM). These events need to be continually exposed and possibly handled by any script working with the plug-in instance in the DOM.
Therefore; these events are not passed to the managed programming model.

7. Can we add the reference of a Class library project in Silverlight application project?
No, You can’t add the reference of a Class library inside the Silverlight application project. You can only add the reference of another Silverlight application project inside a Silverlight application project.
However, you can add the reference of a Web Service or WCF services.

8. What is Silverlight.js file?
Silverlight.js is a helper file which enables Web sites to create advanced Silverlight installation and instantiation experiences.

9. What is the .xap file inside ClientBin folder of consuming Silverlight application?
Following is a very good FAQ about the .xap posted on asp.net page.

Quote:What does XAP mean?
XAP (pronounced ZAP) is the file extension for a Silverlight-based application package (.xap). This file contains the compressed assemblies and resources of a Silverlight 2 application.

10. Quote:What is a .xap file?
xap file is a Silverlight-based application package (.xap) that is generated when the Silverlight project is built.

You may also like

Leave a Comment