"Pro WPF with VB 2008: Windows Presentation Foundation with .NET 3.5"
In other words, when the XAML parser meets the previous markup, it creates an instance of each nested element and passes it to the Grid using the Grid.Children.Add() method: txtQuestion = New TextBox() ... grid1.Children.Add(txtQuestion) cmdAnswer = New Button() ... grid1.Children.Add(cmdAnswer) txtAnswer = New TextBox() ... grid1.Children.Add(txtAnswer) What happens next depends entirely on how the control implements the content property. The Grid displays all the controls it holds in an invisible layout of rows and columns, as you??™ll see in Chapter 4. The ContentProperty attribute is frequently used in WPF. Not only is it used for container controls (such as Grid) and controls that contain a collection of visual items (such as the List- Box and TreeView), it??™s also used for controls that contain singular content. For example, the TextBox and Button are only able to hold a single element or piece of text, but they both use a content property to deal with nested content like this: [Place question here.]
[Answer will appear here.]
The TextBox class uses the ContentProperty attribute to flag the TextBox.Text property. The Button class uses the ContentProperty attribute to flag the Button.