This is another type of XAML syntax that is used to set the content of a UI element. It can be set as the value of child elements. The following example demonstrates how to set the text content property of a Border control to hold a Button control as its child element:
<Border>
<Border.Child>
<Button Content="Click Here" />
</Border.Child>
</Border>
While using Content syntax, you should remember the following points:
- The value of a Content property must be contiguous
- You cannot define an XAML Content property twice within a single instance
Thus, the following is invalid as it will throw XAML error:
<Border>
<Border.Child>
<Button Content="Button One" />
</Border.Child>
<Border.Child>
<Button Content="Button Two" />
</Border.Child>
</Border>