WPF Interview Questions

WPF Interview Questions

There is given frequently asked WPF interview questions and answers that has been asked in many companies. Let's see the list of top WPF interview questions.

1) What is WPF?

WPF stands for Window Presentation Framework. It is the latest presentation API by Microsoft Windows. WPF is a 2D and 3D graphics engine.


2) What are the capabilities of WPF?

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.

3) What are resources in WPF?

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.


4) What is XAML?

XAML is a declarative XML based language. It facilitates you to define objects and properties in XML. Its documents are loaded by XAML parser.


5) What is the use of XAML?

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.


6) What is a routed event?

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.


7) How many types of documents are supported by WPF?

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.


8) What do you know by content alignment in WPF?

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:

Interview Wpf 1

9) Write down the syntax for resources in WPF.

Syntax:

Here,

elementName: Name of the element that uses the resource.

propertyName: Name of the property that takes its value from the resource.

markupExtension: Define type of resource.

keyName: key name of the resource, which is unique string to identify the resource.


10) How many types of resources available in WPF?

There are mainly two types of resources in WPF:

  • Static Resource
  • Dynamic Resource

11) Which namespace is required for working with 3D?

System.Windows.Media.Medi3D is the namespace required for working with 3D.


12) Can we say that WPF is the replacement of DirectX?

No, WPF cannot replace DirectX, because WPF is not enough efficient to create games with stunning graphics. WPF is only meant to be a replacement of windows forms, not DirectX.


13) What are the dependency properties?

Dependency properties are the type of properties which belong to a specific class but can be used for another class.


14) What is CLR?

CLR stands for Common Language Runtime. It is a run time environment for .NET


15) What are the freezable objects in WPF?

An object which is unchangeable is known as freezable object. The freezable objects perform better and also safer if they are required to be shared between threads.


16) What is value converter in WPF?

A value converter acts as a bridge between a target and a source and it is necessary when a target is bound with one source, for instance you have a text box and a button control. You want to enable or disable the button control when the text of the text box is filled or null. In this case you need to convert the string data to Boolean. This is possible using a Value Converter. To implement Value Converters, there is the requirement to inherit from I Value Converter in the System.Windows.Data namespace and implement the two methods Convert and Convert Back.


17) What is the difference between Silverlight and WPF browser application?

These are the main differences between the Silverlight and WPF browser application:

  • .NET framework is needed for running WPF browser application on the client machine while Silverlight runs using only plug-in.
  • The applications made in WPF depend on the operating system because .NET framework only runs on Windows. On the other hand, Silverlight plug-ins can be installed on those OS also, which are not Windows.

18) Which tool is required to sketch a mock of your WPF application?

The SketchFlow tool is used to sketch a mock of WPF application.


19) What are the different types of layout controls?

Following are the different types of layout controls:

  • Grid
  • DockPanel
  • WrapPanel
  • Canvas
  • UniformGrid
  • StackPanel

20) What is PRISM?

PRISM is a framework that is used for creating complex applications for WPF, Silverlight or Window phones. It uses MVVM, IC, Command Pattern, DI and separation of concerns to get loose coupling.


21) What is CustomControl?

CustomControl is used to expand the functions of existing controls. It contains a default style in theme and code file.


22) What is the use of custom control?

Custom control is the best way to make a control library. It can also be styled or template.


23) What is the Path animation in WPF?

Path animation is a different type of animation. In this animation, the animated objects follow a path set by the path geometry.


24) What is the meaning of BAML in WPF?

BAML stands for Binary Application Markup Language. It is a type of XAML that has been tokenized, parsed, and changed into binary form.


25) What is the difference between XAML and BAML?

The only difference between XAML and BAML is that BAML is a compressed declarative language which is loaded and parsed quicker than XAML.


26) What is the difference between Page control and Window Control in WPF?

No.
Page controls
Window controls
1.Page controls preside over the hosted browsers applications.
Window controls preside over windows application.
2.Page controls cannot contain window control.
Window controls may contain page control.

27) What is the parent class of control class of WPF?

The control class of WPF is derived from FrameworkElement.


28) What is the difference between DynamicResource and StaticResource?

StaticResource
DynamicResource
StaticResources evaluate the resource one time only.
DynamicResource evaluates the resources every time they are required.
StaticResource is light.
DynamicResource is heavy due to frequently evaluated.

29) Is MDI supported in WPF?

MDI is not supported in WPF. The same functionality of MDI can be given by UserControl.


30) What is serialization?

Serialization is a process of converting the state of an object to stream of bytes.


31) What is MVVM?

MVVM is stand for Model View ViewModel. It is a framework for making applications in WPF. MVVM is the same as the MVC framework. It is a 3-tier architecture plus one more layer. Loose coupling can be attained by using MVVM.


32) When did MVVM introduced?

MVVM was introduced by John Gossman in 2005. It was introduced specifically to use with WPF as a concrete application of Martin Fowler's broader Presentation Model pattern.


33) What are the advantages of MVVM?

MVVM has the following advantages:

  • Modularity
  • Test driven approach.
  • Separation UI and Business layer as view and view model.
  • Code sharing between pages and forms.
  • Easy to Maintain.

34) What are the most important features of MVVM?

A list of most important features of MVVM:

  • MVVM separates the business and presentation layers, like MVP and MVC.
  • It improves Structure/separation of concerns (View, ViewModel and Model).
  • It enables a better Design/Developer Workflow.
  • It improves simplicity and testability.
  • It is enabled by the robust data binding capability of XAML.
  • No need to use a code behind file (minimalist code-behind file).
  • Provides application development ability for multiple environments.
  • Powerful Data Binding, command, validation and much more.
  • The designer and developer can work together.

35) How is MVVM different from MVC?

MVC stands for Model-View Controller and.MVVM stands for Model-View ViewModel.

In MVVM, View Model is used instead of a controller. This View Model is present beneath the UI layer. It reveals the command objects and data that the view requires. It acts like a container object from which view gets its actions and data.


Latest Courses