#833 – CheckBox is a ContentControl
June 3, 2013 1 Comment
A CheckBox control derives from ContentControl, which means that it can contain a single piece of content. In the case of a CheckBox, this content is rendered next to the actual check box that a user can check on or off.
You typically set the content of a CheckBox to a string, which gets rendered next to the check box.
<CheckBox Content="Learn to juggle"/>
<CheckBox Content="Read War and Peace"/>
<CheckBox Content="Visit Japan"/>

You can, however, set the Content property to anything that you like, including a panel that contains other controls.
<CheckBox VerticalContentAlignment="Center">
<CheckBox.Content>
<StackPanel>
<Image Source="Juggler.png" Height="85"/>
<Label Content="Learn to juggle"/>
</StackPanel>
</CheckBox.Content>
</CheckBox>
<CheckBox VerticalContentAlignment="Center">
<CheckBox.Content>
<StackPanel>
<Image Source="leo.jpg" Height="85"/>
<Label Content="Read War and Peace"/>
</StackPanel>
</CheckBox.Content>
</CheckBox>
<CheckBox VerticalContentAlignment="Center">
<CheckBox.Content>
<StackPanel>
<Image Source="kinkakuji.jpg" Height="85"/>
<Label Content="Visit Japan"/>
</StackPanel>
</CheckBox.Content>
</CheckBox>

