top button
Flag Notify
Site Registration

What are the ways you can declare objects in XAML?

+1 vote
406 views
What are the ways you can declare objects in XAML?
posted Apr 22, 2015 by Sathish Kumar

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

0 votes

There are two ways to declare objects in XAML. The most common way is to declare elements using opening and closing tag - using the object element syntax

XAML

<objectName><objectName/> 

It has a shorter version

XAML

<objectName/>

that can be used if the object has no child elements. See how to set a property and how to declare a child element.

The other way is to create an object indirectly by setting a property. This syntax is used relatively rare. The type or property being set is required to support type converter that takes the string value of the property. This way the object is created from the converter using a string.

answer Apr 22, 2015 by Amit Kumar Pandey
0 votes

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

answer Apr 23, 2015 by Jdk
...