Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

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.

Example

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"/>
</CheckBox>

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

ADD
Show:
© 2014 Microsoft. All rights reserved.