Gets or sets the value of the ContentControl dependency property.
Assembly: System.Windows (in System.Windows.dll)
<contentControl> singleObject </contentControl> -or- <contentControl>stringContent</contentControl>
Property ValueType: System.Object
An object that contains the control's content. The default is null.
Dependency property identifier field: ContentProperty
The property of a ContentControl can be any type of object, such as a string, a UIElement, or a DateTime. When is set to a UIElement, the UIElement is displayed in the ContentControl. When is set to another type of object, a string representation of the object is displayed in the ContentControl.
Content Model: This property is used to set the content of controls that inherit from ContentControl and can be any object.
<StackPanel Name="root" Width="200" HorizontalAlignment="Center" VerticalAlignment="Center"> <!--Create a Button with a string as its content.--> <Button Margin="10" Content="This is string content of a Button"/> <!--Create a Button with a single UIElement as its content.--> <Button Margin="10"> <Rectangle Height="40" Width="40" Fill="Blue"/> </Button> <!--Create a Button with a panel that contains multiple objects as its content.--> <CheckBox Margin="10"> <StackPanel Margin="3,0,0,0" Orientation="Horizontal"> <Ellipse Height="10" Width="10" Fill="Blue"/> <TextBlock TextAlignment="Center" Text="A string of text"></TextBlock> </StackPanel> </CheckBox> </StackPanel>
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.