Include an Image in a CheckBox
Collapse the table of content
Expand the table of content

How to: Include an Image in a CheckBox

.NET Framework 3.0

This example shows how to include an Image in a CheckBox. The example illustrates that a check box can contain content other than text.


The following example creates a CheckBox that contains an Image and some text. When a user clicks the CheckBox, the text changes.

The example uses markup to create the CheckBox and code-behind to create the event handler.

<CheckBox Name="cb6" Checked="HandleChange1"><Image Source="data\flower.jpg" Height="30" Width="30"/>

private void HandleChange1(object sender, RoutedEventArgs e)
    txt.FontSize = 16;
    txt.Text = "I took this photo yesterday.";

For the complete sample, see CheckBox Sample.

See Also

Community Additions

© 2016 Microsoft