Questa pagina è stata utile?
I suggerimenti relativi al contenuto di questa pagina sono importanti. Comunicaceli.
Altri suggerimenti?
1500 caratteri rimanenti
Esporta (0) Stampa
Espandi tutto

Classe CheckBox

Represents a control that a user can select and clear.

Spazio dei nomi: System.Windows.Controls
Assembly: PresentationFramework (in presentationframework.dll)
Spazio dei nomi XML:  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 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.

<CheckBox Margin="10, 10, 3, 3" Grid.Column="0" Grid.Row="2" Name="cb1" FontSize="12" 
Checked="HandleChange">Check Box</CheckBox>

private void HandleChange(object sender, RoutedEventArgs e)
{
    cb1.Content = "You clicked the check box";
}

For the complete sample, see CheckBox Sample.

Altro codice

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

I membri statici pubblici (Shared in Visual Basic) di questo tipo sono validi per le operazioni multithreading. I membri di istanza non sono garantiti come thread safe.

Microsoft .NET Framework 3.0 è supportato in Windows Vista, Microsoft Windows XP SP2 e Windows Server 2003 SP1.

.NET Framework

Supportato in:

Aggiunte alla community

AGGIUNGI
Mostra:
© 2015 Microsoft