Specifies which property of a class to use as the content property when written as XAML.
Assembly: WindowsBase (in WindowsBase.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml
'Declaration <AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple := False, Inherited := True)> _ Public NotInheritable Class ContentPropertyAttribute _ Inherits Attribute 'Usage Dim instance As ContentPropertyAttribute
If the associated property of a is not of type string or object, a type converter will be called at runtime. If a type converter cannot be found at runtime, an exception is thrown.
In order to accept more than a single object element as content, the type of the content property must be a collection type.
An example of a class in Windows Presentation Foundation (WPF) that uses the is ContentControl, which the Button class inherits from. The property Content on the ContentControl is the content property set by the . If a Button is instantiate in XAML, Content of the Button will be set to the element that is between the start and end button tags.
The following example creates a class named Film which is decorated with the . The property named Title is set as the content property.
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.