Top Silverlight Interview Questions and Answers: Below, we have covered detailed answers to the Silver light Interview Questions Which will be helpful to freshers and experienced Professionals. All the best for your interview Preparation.
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. Silver light uses a particular implementation of a XAML parser, with that parser being part of the Silver light core install. In some cases, the parsing behavior differs from the parsing behavior in Windows Presentation Foundation (WPF), which also has a particular implementation. You are looking for Canvas, StackPanel and Grid Storyboard is a Silver light 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> 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: Code: img.Source = new BitmapImage(new Uri(“test.png”, UriKind.Relative)); Given XAML below Code: <Canvas> < Rectangle x:Name=”test” Height=”20″ Width=”20″ Canvas.Left=”0″ Canvas.Top=”10″ /> </Canvas> 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. 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. Silverlight.js is a helper file which enables Web sites to create advanced Silverlight installation and instantiation experiences. 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. xap file is a Silverlight-based application package (.xap) that is generated when the Silverlight project is built. Tools, such as Visual Studio 2008 with the Microsoft Silverlight Tools Beta 2 for Visual Studio 2008, allow you to create Silverlight applications that are heavily client based using managed code. You can use managed code, such as C# or Visual Basic, and benefit by using the tools that you are used to working with. Once you have created the .xap file (explained below), the Silverlight 2 plug-in downloads the file and runs it in a separate work space. 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. 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. UserControl is the parent xaml tag of the Silverlight page. All other tags are placed under UserControl tag. Code: <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> No, Silver light project doesn’t support normal ADO.NET objects like DataTable, DataSet, DataColumn, Database connection providers like SqlConnection, OledbConnection objects. You can use System.Data namespace but that contains Services related stuffs not ADO.NET stuffs. Styles elements are supported in the form of application resources. An app.xaml file can be created containing an application resource Xml construct. The target type for each style is set to the control on which the style needs to be applied. App.xaml: <Application.Resource> <Style x: Key=”MyBorder” TargetType=”Border”> <setter property=”width” value=”5″> </style> Page.xaml: <Border Style=”{StaticResource MyBorder}”> … </Border> Canvas Panel: use a canvas for simple layouts and when there is no need to resize panel. Controls can over have lapped each other when resizing the panel. Stack Panel: use this for grouping controls in a stack (horizontal/vertical). Controls do not over lapped. Grid Panel: most flexible, multi row/columns layouts. Similar to a HTML table Generally, you can’t set the User Control width in % like 100% so that the Silverlight contents can spread in the full screen. To get the 100% width of the screen you can set width=”auto” and height=”auto”. To design the layout of the Silver light application, XAML language is used. Extensible Application Markup Language (XAML, pronounced zammel [‘zæm??]) is a declarative XML-based language created by Microsoft which is used as a user interface markup language to define UI elements, data binding, eventing, and other features. We can either use Visual C# or Visual Basic to code the backend of the silverlight application. Here backend means the code behind files for the Sivlerlight pages. When we create a Silver light application from Visual Studio, two (2) xaml files are created into the Silver light project. They are: App.xaml – App.xaml is a file used to declare shared resources like brushes, various style objects etc. and to handle the global application level event (this is almost similar to global.asax file in asp.net application). By default, following events are created in the App.xaml.cs file. Application_Startup Application_Exit Application_UnhandledException ReportErrorToDOM MainPage.xaml or Page.xaml – This page is the default page of the Silverlight application and when the silverlight application runs this becomes the default page to appear (this page is like the default.aspx page of asp.net application) To change the default page of Silverlight application, you need to set the RootVisual property inside the Application_Startup even of App.xaml file. private void Application_Startup(object sender, StartupEventArgs e) { this.RootVisual = new YourPage(); } 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> ClientBin folder is used to place the .xap file of Silver light application. You can keep this anywhere in your web application but this is the default that is used by the Silver light. Silverlight.js is a helper file which enables Web sites to create advanced Silver light installation and instantiation experiences. No, you can’t add the reference of a Class library inside the Silver light application project. You can only add the reference of another Silver light application project inside a Silver light application project. However, you can add the reference of a Web Service or WCF services. Silver Light is a browser plugin for running it on web where WPF is used for window application. Though they both make use of XAML. RIA means rich internet applications. They are web applications with rich features. Rich features include built in AJAX support, animations, layouts, audio and video components. Silver light applications are examples of RIA. Both WPF and Silverlight are the technologies used for creating applications that have a rich user interface (i.e.: Animations, Brushes,Drawings, Layouts etc). Both use XAML for the designing and use OOPS SilverlIght 2 onwards supports OOPS But a lot of differences exist between these two technologies WPF (Windows Presentation Foundation): Silver Light: It is basically a component that is responsible for downloading the .xap file from the server and help the users to see the silver light content’s olutput in a web page .xap file is basically a file that connects the silver light functionality with .aspx page…xap file is used for referencing the Silver light resources on a .aspx page. it is a file used in WPF/Silver Light applications. Its settings affect the different .xaml pages. It is used for these reasons This folder is used in the ASP.NET application that will be using the Silver light functionality. This folder contains the .xap file that contains the references of the Silver Light Libraries which will then be used in the ASP.NET application. Location of the ClleintBin Folder :It is below the root folder of the Web Application that is attached with the Silver Light application 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(); } 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. 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. .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. 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. 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. Eg: private void Application_Startup(object sender, StartupEventArgs e) { this.RootVisual = new YourPage(); } What is XAML?
What is the difference between WPF and Silverlight?
Can you name built-in layout panels you have been using with Silver light?
What is Storyboard?
How can you set image Source dynamically from C# application to” test.png” file?
How to perform Event handling in silverlight?
Can we add the reference of a Class library project in Silverlight application project?
What is Silverlight.js file?
What does XAP mean?
What is a .xap file?
Why is XAP important?
How does XAP work?
How do I use a .xap file?
What is the use of ClientBin folder?
What is the parent xaml tag of Silverlight page?
Is ADO.NET objects supported in Silverlight Project?
How can style elements be applied? (similar to a CSS file/skins)
Can you provide a list of Layout Management Panels and when you will use them?
How to set Silver light contents width as 100%?
Which language is used to design the layout in Silverlight?
Which programming language can be used to write the backend of the Silverlight application?
When you create a new project in Silver light through Visual Studio, how many xaml files are created and what are the uses of those files?
How to change the default page of the Silver light application?
What is the parent xaml tag of Silverlight page?
What is the use of ClientBin folder?
What is Silverlight.js file?
Can we add the reference of a Class library project in Silverlight application project?
What is the difference between WPF and Silverlight?
What is RIA?
What are the differences between WPF and Silver Light?
What is Silverlight Runtime?
What is App.xaml?
What is the use of the ClientBin folder?
How can you change the startup page of SilverLight application?
What is Silverlight Run time?
Can we add the reference of class library project in silver light application project?
What is .xap file?
What is the use of Client Bin folder?
How to change the default page of silver light application?
Related posts:
- .Net Assembly Interview Questions and Answers
- .Net Developer Interview Questions and Answers
- ASP.Net MVC Interview Questions and Answers
- Microsoft Dynamics NAV Interview Questions and Answers
- Sharepoint Interview Questions and Answers
- VB Script Interview Questions and Answers
- VB.Net Interview Questions and Answers
- WCF Interview Questions and Answers