Most Asked WPF Interview Questions and Answers

WPF Interview Questions and Answers most commonly asked for Experienced PDF, Freshers candidates for Employment.

State the name of the classes, which contain arbitrary content.

Content Control

HeaderedContent Control

Items Control

HeaderedItems Control

Which NameSpace has ‘Popup’ and ‘Thumb’ controls?

The namespace has ‘Popup’ and ‘Thumb’ controls.

What is XAML? What is the difference between XML and XAML?

XAML stands for eXtensible Application Markup Language. It is the language used to instantiate.NET objects.  It is the language developed by Microsoft to write user interface for next generation applications.

XML is designed to store data or to work with the stored data, whereas XAML is the extended version of XML used for.NET programming.

Mention the advantage of using XAML?

The advantage of using XAML is

  • XAML code is clear to read, and they are short

  • Separation of designer code and logic

  • Tools like expression blend used for graphical design require XAML as source

  • It clearly separates the roles of designer and developer

How can you code to display “Hello World” in XAML?

Displaying “Hello World.”

<page xmlns= ‘’ ‘’>


Hello, World!



In XAML how graphic components are specified?

In XAML, graphic components are specified with by open or closed tags with attributes.

For example,

  • Tag with contents




  • Tag without contents

< Button/>

What is Attribute Syntax in XAML?

In XAML, attribute syntax sets a value for a property or names the event handler for an event, by declaring an attribute on an element.  The attribute value should be enclosed within two quotation marks (“).

For example,

< Button Background = “Black” Foreground “Red” Content = “This is an operating button”/>

Explain Content Properties XAML?

XAML represents a language feature whereby a class can allot exactly one of its properties as XAML property

What is Markup extension in XAML?

Markup extensions are placeholders in XAML that are used to resolve property at runtime. A markup extension allows you to extend XAML and using attribute syntax you can also set any property that can be set in XAML.The purpose of the mark up extension is to process a string and return an object. Some of the standard markup extensions are xNull, x: Array, :StaticResource  and DynamicResource.

What are the four general kinds of XAML elements?

The four general kind of XAML elements are

  • Root Elements

  • Panel Elements

  • Control Elements

  • Geometric Elements

What X: prefix indicates in XAML?

The X: prefix is used to map the XAML namespace in templates.

What are the various X: prefix used in XAML language?

  • x: Key à It sets a unique key for each resource in a Resource Dictionary

  • x: Classà It specifies the CLR ( Common Language Runtime) namespace and class name for the class that provides code

  • x: Name à It specifies a run-time object name for the instance that exist in run time code after an object element is processed

  • x: Static à It enables a reference that returns a static value which otherwise an XAML compatible property

  • x: Type à It constructs a Type reference based on the type name

How can you set a property attribute as a literal string and not a mark up extension?

To avoid mark up extension you have to use an empty pair of curly braces like

Content = “{} {This is not a markup extension}”/>

What are the types of children does object element can have in XAML?

Three types of children an object element can have

  • Collection Items

  • A value for the content property

  • The value that can be type-converted to the object element

What is Type Converter?

The type converter is helpful to convert a string into the appropriate value type where there is no markup extension usage.  Type Converter defines four members for converting to and from string for xaml purposes.

  • CanConvertTo

  • CanConvertFrom

  • ConvertTo

  • ConvertFrom

Explain Object Element Syntax in XAML?

To instantiate a CLR class or structure by declaring an XML element, an XAML markup syntax is used.  This syntax is referred as Object Element Syntax.

What are the ways you can declare objects in XAML?

To declare objects in XAML, there are three ways

  • Directly, using object element syntax: This syntax is used to declare root objects or nested objects that set property values

  • Indirectly by using attribute syntax: This syntax uses an inline string value which has an instruction on how to create an object. To set the value of the property to a newly created reference, the XAML parser uses this string

  • Using a markup extension

What should a root element of an XAML document contain?

In XAML document, the root element consists only certain elements, and these elements are Window, a Canvas or panels.

What is data binding with XAML?

Data binding provides a simple way to display and interact with data. An example will show how you can do data binding in XAML.  The binding in XAML is done by using {binding….} syntax.

Explain how you can display different data at run time and design time?

  • One way of displaying data at run time and design time is to declare your data in XAML.

  • Another way of doing it is by declaring it in XAML by using various data attributes from the designer XML namespace.  With a d: prefix, this namespace is typically declared.


What is the function x: Key directive in XAML?

X: Key uniquely identifies elements that are created and referenced in an XAML defined dictionary. By adding an x: Key value to an XAML object element a resource in the resource dictionary can be identified and is the most common way to identify.

What is the use of property element syntax?

With the help of property element syntax, you can add children element with a name in the form of parent.propertyName.

How custom classes used in XAML can be defined?

Custom classes are used in two ways

  • With the code that produces the Primary Windows Presentation Foundation (WPF) application or within the code behind

  • In a separate assembly as a class, such as an executable or DLL used as a class library

What is Xaml Namespace?

Namespace can be defined as an environment or an abstract container used to hold a logical grouping of unique identifiers or symbols.


Popular posts from this blog

TOP Agile Testing Interview Questions and Answers

Latest Agile Testing Interview Questions and Answers

Most Asked ADO.NET Interview Questions and Answers