From the course: Microsoft XAML: 2 Content and Properties

Unlock the full course today

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

Content as an object in XAML

Content as an object in XAML

From the course: Microsoft XAML: 2 Content and Properties

Start my 1-month free trial

Content as an object in XAML

- [Instructor] In this video, I'll look at how to assign content to a control or an element, that only supports a single child content. Most of those derive from this base class here, it's called content control. I've opened up dot peak, I've disassembled the code for the content control, and you'll see that on line 28 it says that the content property is named content. Here's where that property's defined, and the interesting thing here is that the data type of this property is object. That means that any type in dot net can be used as content inside the content control. You're probably asking yourself what are some of the content controls? Let me show you. Switch over to visual studio, I've opened this file here called content controls dot CD, that stands for class diagram, and this allows you to have a visual representation of your classes and your base classes. And here's content control, and here's the button class, this is the one I'll be using most in this demo, button, and it…

Contents