Top 41 Microsoft Silverlight Interview Questions You Must Prepare 02.Oct.2022

In XAML, a button can be created as in the following example:

Example:

<Grid x:Name="LayoutRoot" Background="White">

<Button Width="60" Height="30">Click Here</Button>

</Grid>

Silverlight is a plugin that is provided by the Microsoft. Silverlight architecture includes the functionality from core .NET framework, Ajax and having some of its own functionality such as animation, media etc. The architecture consists of four blocks:

.NET framework components: WPF is .NET framework, used in Silverlight. 

Presentation core: core presentation framework includes the display options such as images, vector animations etc.

Other technologies: Ajax and JavaScript technologies are used to interact with Silverlight framework.

Hosting: Silver-light animations run under the browser environment and it also provides lots of other application hosting programs.

To change the default page of silver light application, you need to set the Root Visual property inside the Application_Startup event of App.xaml file.

Example:
private void Application_Startup(object sender,StartupEventArgs e)
 {
this.RootVisual = new YourPage();
 }

The following happens if we press F5 in Visual Studio to run a Silverlight Application.

a)A new folder is created in website project.(It happens only first time)
b)The name of the folder is Clientbin.
c)The folder contains the packages with .xap extension.

The real advantage of using Excel or World files or any local database in Silverlight is that it provides easy to manage features for store and fetching the data, which are frequently used by the applications. It doesn’t rely much on WCF services to provide the properties for data communication. The data is automatically fetched and saved in excel or word sheets for future references.

Yes, Silverlight supports desktop implementation. Newer version of Silverlight provides out-of-browser facility, by using this feature it can be physically deployed on the local machine. Silverlight 4.0 supports OOB facility that enhances the communication with other applications like Word, Excel etc. and with the local database like MS Access etc.

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 Code:

<Canvas> <Ellipse x:Name="ellipseTest" Height="20" Width="20" Canvas.Left="0" Canvas.Top="10" /> </Canvas>

Easing functions is used in Silverlight to utilise custom mathematical formulas to animations. For example,if we want an object to oscillate we could use we can use a corresponding mathmetical function to accurately depict this motion.

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.

You can show the silverlight application in full-screen mode by using the following command:

Application.Current.Host.Content.IsFullScreen = true;

Silver light run time is a plug-in for browsers to support silver-light enabled applications. If silver light run time is not installed, browsers will not be able to run silver light elements in the browser. We can setup the silver light tags such a way that your browser will automatically prompts the user to download and install the silver light plug-in when your application is launched in the browser.

XAML is the language which is used with Silverlight. It is one of the growing languages that has lots of features and properties. The advantages of it over C# or VB.NET are that:

C# or VB.NET provide development by using coding whereas, XAML provides codeless development and provides lots of features to create complex user interface controls etc. It can also define an instance of class which is being already defined by C# or VB.NET.

.xap file is a silver light based application package that is generated when the silver light project is built.Once we have created the .xap file, the silverlight plug-in downloads the file and runs it in a separate workspace.

Canvas Panel: Use the canvas for simple layouts and when there is no need to re-size panel. Controls can overlap each other when resizing the panel.

Stack Panel: Use this for grouping controls in a stack (horizontal/vertical). Controls do not overlap.

Grid Panel: Most flexible, multi rows/columns layouts. Similar to a HTML table.

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.

Silverlight provides and supports lots of features but there are some restrictions as well, such as WS-Security and WS-Addressing are not supported. When working with the languages such as ASMX/JAVA/PHP, you need to see that you have SOAP 1.1 and WS-I Basic Profile 1.@Silverlight only support GET and POST actions, others are not supported. It doesn’t have full http features also.

ClientBin folder is used to place the .xap file of Silverlight application. You can keep this anywhere in your web application but this is the default that is used by the Silverlight.

No, we can’t add the reference of class library inside the silver light application project. We can only add the reference of another silver light application project inside the silver light application project.However, we can add the reference of Web Service or WCF Service.

4 simple steps to consume WCF service using Silver light

  • Create the WCF service
  • Enable Cross Domain for your WCF service
  • Add the WCF service reference
  • Call the Service

Silverlight is a plug-in, which can be used to develop web based or mobile based applications. Silverlight is used in those applications where you need to represent the graphics or the output should be in graphical format. Silverlight can be used in various types of Line-of-Business applications such as: Healthcare, Insurance, Logistics etc. One of the good example of its application is healthcare application.

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

Name scope in Silverlight stores the relationship between XAML and the objects which are being defined by the XAML, with their instance equivalents. Whenever, you create a new object, a new name scope will automatically be created. But, there is a problem in this, when name scope is being created for the dynamic objects, sometimes it causes an exception to occur or some kind of error.

The .xap file is a compressed output file for the Silverlight application. This file includes AppManifest.xaml, compiled output assembly of the Silverlight project (.dll) and other resource files referred by the Silverlight application.

A Storyboard in the Silverlight is a container where we can put animation objects. We need to make the Storyboard a resource that is available to the objects that we want to animate.

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.

Silverlight version 2 supports all popular browsers like Internet Explorer,Firefox,Safari on Both Mac OS and windows OS.

Silverlight provides lots of applications for Line-of-Business (LOB) to have better communication among the elements and also to enrich the properties of the application. The controls which are being provided by the Silverlight are as follows:

Data Grid: The representation of data in a grid form

Data Form: Representation of data in a form 

Chart controls: Representation of data in chart forms and has additional functionality to display the controls for customization.

You can change the default page settings of a silverlight page.

This can be done by setting the RootVisual property in the Application_Startup event of the App.xaml file.

This is done as follows:

Private void Application_StartUp(object sender, StartupEventArgs e)

{

   this.RootVisual = new MainPage();

}

xap file is a Silverlight-based application package (.xap) that is generated when the Silverlight project is built.

Silverlight can support many types of video files.
This platform can support MP3, Windows Media Audio format (wma, wmv7-9), and also VC-1 formats.

Yes, you can use any specific patterns in Silverlight programming, as it provides Model-View or View-Model approach. This approach provides the provision to create loosely coupled application where the code is completely isolated from XAML. Prism which is a set of classes provided for development of such applications can also be used to provide more flexibility.

  • Deep Zoom is one of the features of silverlight.
  • This Deep Zoom function is to zoom in and zoom out the application.
  • The main advantage of this zooming is that, it will not affect the performance of the application.

Client Bin folder is used to place the .xap file of silver light application. We can keep this anywhere in our web application but this is the default that is used by silver light.

  • As we know that, the applications with Ajax runs faster when compared to Java applet.
  • This is because, Java applets load big sized libraries.
  • But in Ajax, code resides on the web server where, only the required event in the user interface is posted back to the server.

UserControl is the parent xaml tag of the Silverlight page. All other tags are placed under UserControl tag.

 <UserControl x:Class="SilverlightApplication2.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    Width="400" Height="300">

 <Grid x:Name="LayoutRoot" Background="White">
    </Grid>
</UserControl>

Silverlight is used to read and render the user interface (UI) elements. XAML is a XML file that defines the user interface elements. This file is being read by the WPF framework. Microsoft developed WPF framework and then extended it to WPF/e, which helped the application to render user interface in the browser. Silverlight is being officially launched by Microsoft.

Open the App.xaml.cs file
In the Application_Startup event handler, set the RootVisual property to the instance of the particular SilverlIght class

example: if we have a file known as MainPage.xaml, a class known as MainPage will be there in MainPage.xaml.cs.

private void Application_Startup(object sender, StartupEventArgs e)

{

this.RootVisual = new MainPage();

}

Silverlight application resides on the host computer where the ASP.NET is installed. It resides in the ASP.NET webpage, but it can be hosted on other HTML pages too, by using the extension .xap. Silverlight application is made available to the browser when a user makes a HTTP request to ASP.NET page.

Silver light uses isolated storage as a virtual file system to store data in a hidden folder on your machine. It breaks up the data into two separate sections:

Section #1 contains the administrative information such as disk quota

Section #2 contains the actual data.

Each silver light application is allocated its own portion of the storage with the current quota set to be 1 MB per application.

 

Silverlight is Microsoft based technology and it come up with some security features, to make it secure to use and implement. For secure communication its applications makes use of WCF services and uses WCF security features. SSL (Secure Socket Layer) can be used for security mechanism to give the trport layer security.