Some controls can contain an object of any type, such as a UIElement, or non-UI type like a string or DateTime object. This tutorial shows how to use XAML to define a button that contains an image and some text; or a CheckBox can contain the value of a string.
- [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 derives from this abstract class here…
- What does content mean in XAML?
- Using dotPeek to show property values for XAML elements
- Expressing content as objects, lists, or dictionaries in XAML vs. code
- Exploring dependency and attached properties
- Working with attached properties in the grid and canvas
- Using custom dependency properties