Export (0) Print
Expand All
0 out of 2 rated this helpful - Rate this topic

CheckBox Class

Represents a control that a user can select and clear.

Namespace: System.Windows.Controls
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

[LocalizabilityAttribute(LocalizationCategory.CheckBox)] 
public class CheckBox : ToggleButton
/** @attribute LocalizabilityAttribute(LocalizationCategory.CheckBox) */ 
public class CheckBox extends ToggleButton
LocalizabilityAttribute(LocalizationCategory.CheckBox) 
public class CheckBox extends ToggleButton
<CheckBox>
  Content
</CheckBox>

CheckBox controls inherit from ToggleButton and can have three states: checked, unchecked, and indeterminate. For more information about the indeterminate state see Indeterminate.

You can display CheckBox controls in a group so that users can choose from a list of options. You can also offer users a combination of options.

ContentModel: A CheckBox is a ContentControl which means that a CheckBox can contain content such as text or images For more information about the CheckBox content model, see Content Control Content Model.

This example creates a CheckBox control.

The following example creates a CheckBox control by using markup to create the check box and code-behind to handle the Click event.

When a user selects the CheckBox, the text changes.

For the complete sample, see CheckBox Sample.

More Code

How to: Include an Image in a CheckBox

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

How to: Create a Control That Has an Access Key and Text Wrapping

This example shows how to create a control that has an access key and supports text wrapping. The example uses a Label control to illustrate these concepts.

System.Object
   System.Windows.Threading.DispatcherObject
     System.Windows.DependencyObject
       System.Windows.Media.Visual
         System.Windows.UIElement
           System.Windows.FrameworkElement
             System.Windows.Controls.Control
               System.Windows.Controls.ContentControl
                 System.Windows.Controls.Primitives.ButtonBase
                   System.Windows.Controls.Primitives.ToggleButton
                    System.Windows.Controls.CheckBox
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.