WPF Interview Questions and Answers
Question - 21 : - What are Freezable objects in WPF?
Answer - 21 : -
An object, which has its state locked down, so that it becomes unchangeable, is known as a freezable object. Such objects perform better. It is also safer if they are required to be shared between threads.
Question - 22 : - Why should WPF be preferred over Adobe Flash?
Answer - 22 : -
WPF is a more recent technology and thus has the latest development tools. It supports a broader range of programming languages and has a robust control reuse.
Question - 23 : - How is Silverlight different from WPF browser application?
Answer - 23 : -
One of the major differences is that .NET framework is required for running WPF browser applications on the client machine. But Silverlight runs using only the plug-in. Another point of difference is that applications made in WPF depend on the OS as .NET Framework only runs on Windows. On the other hand, the Silverlight plug-in can be installed on those OSs also, which are not Windows.
Question - 24 : - Name the methods present in the DependencyObject.
Answer - 24 : -
It has three objects, namely:
- SetValue
- ClearValue
- GetValue
Question - 25 : - What are the capabilities of WPF?
Answer - 25 : -
WPF has following capabilities:
- It has all the equivalent common user controls like buttons, checkboxes, sliders etc.
- It has all the capabilities of HTML and Flash.
- It supports fix and flow format document.
- It provides the facility of data binding, animation and multimedia.
Question - 26 : - What are resources in WPF?
Answer - 26 : -
In WPF, resources are used to provide a simple way to reuse commonly defined objects and values. They also facilitate you to set the properties of multiple controls at a time. For example, you can set the background property on several elements in a WPF application using a single resource.
Question - 27 : - What is the use of XAML?
Answer - 27 : -
XAML is used to describe the objects, properties and their relation in between them. It makes you able to create any type of objects i.e. graphical and non-graphical.
Question - 28 : - What is a routed event?
Answer - 28 : -
There are many types of elements in a typical WPF application and these elements are set in an element tree relationship. A routed event is a type of event that is used to invoke handlers on multiple listeners in an element tree.
Question - 29 : - How many types of documents are supported by WPF?
Answer - 29 : -
Two types of documents are supported by WPF.
Flow format document: Flow format document is used to alter the content to fit on the screen size.
Fixed format document: Fixed format document present content irrespective of the screen size.
Question - 30 : - What do you know by content alignment in WPF?
Answer - 30 : -
There are two types of content alignment in WPF:
- HorizontalContentAlignment
- VerticalContentAlignment
These both properties are defined in the System.Windows.Controls.Control class which is the parent class of all controls in WPF.
By default the vertical and horizontal alignment of content of a TextBox is left and top and button is center.
For example: