From the course: Microsoft XAML: 2 Content and Properties

Unlock the full course today

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

Use children elements as content

Use children elements as content

From the course: Microsoft XAML: 2 Content and Properties

Start my 1-month free trial

Use children elements as content

- [Instructor] One way to assign content to a XAML element is by nesting a child element within the parent. To start this discussion, I'll look at some XML rules about child elements. I'll use this example in the XML file. A primary rule of XML is that you are only allowed a single root element. In my example, I called it RootElement, you see here in line five. And all of my other elements are nested inside the RootElement. On line six, I've got an example of a ChildElement that has an opening tag but does not have a closing tag. This is sometimes called a single tag element. On line seven, I've got an example of another single tag element. This time, I'm using a principle of XML known as a attribute. So this is a name value pair that is always lives inside the beginning tag. You can nest multiple levels here. I've got an example of a child element with multiple nested children and one of the principles I want to show here is that the way you name your elements. You can use most…

Contents