Advanced WPF Interview Questions and Answers for Freshers - 3

Question: 11

What are the different types of applications that you can create in WPF using Visual Studio 2010?

Visual Studio 2010 provides project templates to create WPF applications. There are primarily two types of WPF applications:

Standalone applications – Refer to applications that work as a standalone desktop application. These applications are same as the Windows Forms applications that you have to install on every client. The center point of designing a standalone application is a window, which is an object of the Windows class.

XAML browser applications (XBAPs) – Refer to applications that are hosted on server and are accessed through a browser, such as Internet Explorer and Netscape. You do not require to install these applications on the client system. The XBAPs are same as the ASP.NET Web application designing and working.

Question: 12

What does a control template do?

The WPF controls provide the template to define the look, style, and state of the controls.

Every WPF control provides the default control template.

However, you can create a new template to provide a new look and behavior to a control.

The control template is an instance of the Control Template class, which inherits the Framework Template class.

Question: 13

What do you understand by serialization and deserialization of documents?

While working with WPF documents, the documents are created and stored in a data store of the application.

The documents are then loaded from the data store to the memory.

When a document is loaded from the in-memory representation to the data store, it is known as serialization.

When the document is loaded from the data store to the memory, then it is known as deserialization.

Serialization of documents is performed by calling the write method to save the document, while deserialization of documents is performed by the read method to access the documents from the data store. The System.Windows.Documents.Serialization namespace contains the classes that are used to serialize and deserializing documents.

 

Question: 14

What are triggers?

The triggers are objects that raise an action when a particular condition occurs. Suppose you want to change the background color of a button control when user move the mouse over it then you should use trigger to implement this action. In WPF, triggers are used to set property values or perform actions. The following are the two types of triggers in WPF:

Property triggers – Sets the property value and raises the action when any changes happen in the property value. When the trigger removes the condition, the changes made by the trigger in property values are undone. Property triggers can perform more than one task through Trigger. Enter Actions and the Trigger. Exit Actions properties.

Event triggers – Raises an action when a Particular event occurs. Once the event has occurred, the task performed by an event trigger cannot be reversed back. Event triggers are instances of the Event Trigger class and are represented by the Event Trigger element.

Question: 15

What are Container controls?

The Container controls contain other controls or elements. These controls provide the predefined layout for its sub controls. Some of the common container controls in WPF are

Grid – Provides a grid with one or more cells that are formed by creating rows and columns. The grid control’s every cell can contain sub controls.

UniformGrid – Provides a grid in which the cells are of the same size. The control cells are automatically adjusted to hold the controls.

Canvas – Refers to a built in layout that enables accurate positioning of its sub controls by using coordinates.

DockPanel – Refers to a built layout that enables its sub controls to get arranged in a vertical or horizontal manner along its boundary.

StackPanel – Provides a built in template that allows its sub controls to be arranged in a vertical or horizontal stack.

Related Questions