#79 – Content Properties for Common WPF Types

Here is a list of the content properties for some common WPF types.  You can set values for these properties in XAML using one or more child elements directly, rather than having to use the property element syntax.

E.g. Because Text is the content property for a TextBox, you can specify a value for Text as a child element of the TextBox element:

 <TextBox Height="23" Width="120">
     Some text...
 </TextBox>

Here is the list of some common WPF types and their content properties:

  • Button – Content
  • CheckBox – Content
  • ComboBox – Items
  • Grid – Children
  • GridView – Columns
  • GroupBox – Content
  • Label – Content
  • ListBox – Items
  • ListView – Items
  • Page – Content
  • Panel – Children
  • StackPanel – Children
  • TextBox – Text
  • TreeView – Items
  • Window – Content

For a more complete list, see Building A List of Types That Have Content Properties.

Advertisements

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

One Response to #79 – Content Properties for Common WPF Types

  1. Pingback: Day #1: Introduction to XAML Part I | Thirty Days of WPF

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: