You are on page 1of 3

WPF-Descriptive Questions XAML Overview

Questions:-

1. What is XAML?
2. What is BAML?
3. What are the Advantages of using XAML in WPF?
4. What are the basic rules of XAML?
5. What is the difference between X:name and x:key?
6. What is xmnls in XAML file?
7. What is the difference between xmlns and xmlns:x in WPF ?
8. What is App.xaml file in WPF Project?
9. What is a Type Converter in WPF?
10. What is a Markup Extension in WPF?
11. What are the built-in markup Extension?
12. What is Attached property in WPF?

1. What is XAML?
Ans. XAML stands for Extensible Application Markup Language. It’s a simple language based on XML to
create and initialize .NET objects with hierarchical relations.It is used to create user interfaces in WPF,
Silverlight, declare workflows in WF and for electronic paper in the XPS standard.

2. What is BAML?
Ans. BAML stands for Binary Application Markup Language. When you compile a WPF application in Visual
Studio, all your XAML files are converted into BAML, and that BAML is then embedded as a resource into
the final DLL or EXE assembly.

3. What are the advantage of using XAML in WPF?


Ans.
i. XAML is a richer language, offering the ability to create user interfaces in Windows.
ii. Microsoft describes XAML as "toolable" that means XAML can be manipulated using software
tools. This helps the separation of the GUI design from implementation.
iii. Keep you a clean separation of markup and code (e.g. by applying the MVVM pattern).
iv. XAML Code is short and clear to read
v. Graphical design tools like Expression Blend requires XAML as Source.

4. What are the basic rules of XAML?


Ans.
i. XAML files have the .xaml file extension.
ii. XAML is XML based, so it must be well formed.
iii. The first tag in the XAML page is the root element. All other elements are children of this root
element. Also, the XML declaration (<?xml version="1.0" encoding="UTF-8" ?>) is not required.
iv. Tags cannot overlap.
v. Whenever attributes are assigned values, they must be enclosed in single or double quotation
marks.
WPF-Descriptive Questions XAML Overview

vi. XAML is case sensitive.


vii. The inner text of an element must not include special characters such as "<" or "&".
viii. You must specify the namespace that tells the XAML parser which assemblies must be searched
to find the tags that are being referenced. For this, XAML uses the namespaces tag. The default
namespace is xmlns="http://schemas.microsoft.com/2003/xaml".

5. What is the difference between x:name and x:key?


Ans. x: name identifies a UIElment in XAML Tree. x:Key identifies objects in resources section, can be
accessed by resourceDictionary.

6. What is xmnls in XAML file?


Ans. “xmlns” stands for XML namespaces. It helps us to avoid name conflicts and confusion in XML
documents.

7. What is the difference between xmlns and xmlns:x in WPF ?


Ans. The two namespaces helps to define/resolved XAML UI elements.
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" this helps to resolve overall WPF
elements.
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" this namespace is prefixed by x: and helps to
resolve XAML language definition.

8. What is App.xaml file in WPF Project?


Ans. App.xaml is the startup file which, triggers your first XAML page from your WPF project.

9. What is a Type Converter in WPF?


Ans. The TypeConverter is used to convert values between data types, and to assist property
configuration at design time by providing text-to-value conversion. It uses InstanceDescriptor and
System.Reflection to provide the information necessary to initialize a property at run time. Most native
types have an associated TypeConverter. The default type converters are in the System.ComponentModel
namespace and are named TypeConverterNameConverter. WPF and Silverlight make extensive use of the
TypeConverter in binding.
TypeConverter defines four members that are relevant for converting to and from strings for XAML
processing purposes:- ConvertTo or ConvertFrom and also the corresponding CanConvertTo and
CanConvertFrom.

10. What is a Markup Extension in WPF?


Ans. Markup Extensions gives the flexibility to create custom objects into your XAML attributes. Thus
Markup extensions are dynamic placeholders for attribute values in XAML. Markup extensions are
surrounded by curly braces (Example: Background="{StaticResource NormalBackgroundBrush}").

11. What are the built-in markup Extension?


Ans.
i. Binding: To bind the values of two properties together.
ii. StaticResource: One time lookup of a resource entry
iii. DynamicResource: Auto updating lookup of a resource entry
WPF-Descriptive Questions XAML Overview

iv. TemplateBinding: To bind a property of a control template to a dependency property of


the control
v. x:Static: Resolve the value of a static property.
vi. x:Null: Return null

12. What is Attached property in WPF?


Ans. Attached properties in XAML are typically used through attribute syntax. In attribute syntax, you
specify an attached property in the form ownerType.propertyName.

You might also like