From the course: Microsoft XAML: 1 Core Concepts

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Property elements: The alternative to property attributes

Property elements: The alternative to property attributes

From the course: Microsoft XAML: 1 Core Concepts

Start my 1-month free trial

Property elements: The alternative to property attributes

- [Instructor] XAML has two ways of setting a property value in XML. You can use a property element or property attribute. Line eight shows an example of a property attribute. The text attribute is an example of a property attribute and I'm assigning the hello string to that. And when you look at the text block over here in the UI you see that string appear. Line 10 shows an example of a property element. This is an alternate syntax. It uses an element, hence the name, and that element has a period in the center of it. To be clear this is a valid XML element. That period in the middle tells the XAML parser to do something special. And here's what the XAML parser does. When it sees this element inside the text block, it notices it has the same string at the beginning of the element, so it knows that this is a property element. Then after the period it knows that that is the name of the property in the class. So it'll assign this string here to the text property. I know what you're…

Contents