XAML Interview Questions & Answers

  1. Question 1. What Is Xaml? What Is The Difference Between Xml And Xaml?

    Answer :

    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.

  2. Question 2. Mention The Advantage Of Using Xaml?

    Answer :

    The advantage of using XAML in

    • 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.
  3. XML Interview Questions

  4. Question 3. How Can You Code To Display “hello World” In Xaml?

    Answer :

    Displaying “Hello World.”

    Hello, World!

  5. Question 4. In Xaml How Graphic Components Are Specified?

    Answer :

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

    For example:

    Tag with contents

    Click

    Tag without contents

    < Button/>

  6. XML Tutorial

  7. Question 5. What Is Attribute Syntax In Xaml?

    Answer :

    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”/>

  8. C#. NET Interview Questions

  9. Question 6. Explain Content Properties Xaml?

    Answer :

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

  10. Question 7. What Is Markup Extension In Xaml?

    Answer :

    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 null, x: Array, :Static Resource and Dynamic Resource.

  11. C#. NET Tutorial
    Visual Basics Interview Questions

  12. Question 8. What Are The Four General Kinds Of Xaml Elements?

    Answer :

    The four general kind of XAML elements are

    • Root Elements
    • Panel Elements
    • Control Elements
    • Geometric Elements
  13. Question 9. What X: Prefix Indicates In Xaml?

    Answer :

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

  14. OOPS Interview Questions

  15. Question 10. What Are The Various X: Prefix Used In Xaml Language?

    Answer :

    • 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.
  16. LINQ Tutorial

  17. Question 11. How Can You Set A Property Attribute As A Literal String And Not A Markup Extension?

    Answer :

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

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

  18. LINQ Interview Questions

  19. Question 12. What Are The Types Of Children Does Object Element Can Have In Xaml?

    Answer :

    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.
  20. XML Interview Questions

  21. Question 13. Explain What Is Type Converter?

    Answer :

    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
    • Convert To
    • Convert From
  22. Windows Presentation Foundation(WPF) Tutorial

  23. Question 14. Explain Object Element Syntax In Xaml?

    Answer :

    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.

  24. Question 15. What Are The Ways You Can Declare Objects In Xaml?

    Answer :

    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.

  25. Windows Presentation Foundation(WPF) Interview Questions

  26. Question 16. What Should A Root Element Of An Xaml Document Contain?

    Answer :

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

  27. MVVM Tutorial

  28. Question 17. What Is Data Binding With Xaml?

    Answer :

    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.

  29. MVVM Interview Questions

  30. Question 18. Explain How You Can Display Different Data At Run Time And Design Time?

    Answer :

    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.

    xmlns: d= http://schemas.microsoft.com/expression/blend/2008

  31. C#. NET Interview Questions

  32. Question 19. Explain What Is The Function X: Key Directive In Xaml?

    Answer :

    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.

  33. Windows Communication Foundation (WCF) Tutorial

  34. Question 20. Explain What Is The Use Of Property Element Syntax?

    Answer :

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

  35. Windows Communication Foundation (WCF) Interview Questions

  36. Question 21. How Custom Classes Used In Xaml Can Be Defined?

    Answer :

    Custom classes are used in two ways:

    1. With the code that produces the Primary Windows Presentation Foundation (WPF) application or within the code behind.
    2. In a separate assembly as a class, such as an executable or DLL used as a class library.
  37. Question 22. What Is Xaml Namespace?

    Answer :

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

  38. Microsoft Expression Web Tutorial