ToggleButton.IsChecked Właściwość
Definicja
Pobiera lub ustawia czy ToggleButton jest zaznaczone.Gets or sets whether the ToggleButton is checked.
public:
property Nullable<bool> IsChecked { Nullable<bool> get(); void set(Nullable<bool> value); };
[System.ComponentModel.TypeConverter(typeof(System.Windows.NullableBoolConverter))]
[System.Windows.Localizability(System.Windows.LocalizationCategory.None, Readability=System.Windows.Readability.Unreadable)]
public bool? IsChecked { get; set; }
[<System.ComponentModel.TypeConverter(typeof(System.Windows.NullableBoolConverter))>]
[<System.Windows.Localizability(System.Windows.LocalizationCategory.None, Readability=System.Windows.Readability.Unreadable)>]
member this.IsChecked : Nullable<bool> with get, set
Public Property IsChecked As Nullable(Of Boolean)
Wartość właściwości
true
Jeśli ToggleButton jest zaznaczone; FAŁSZ Jeśli ToggleButton nie jest zaznaczone; w przeciwnym razie null
.true
if the ToggleButton is checked; false if the ToggleButton is unchecked; otherwise null
. Wartość domyślna to false
.The default is false
.
- Atrybuty
Przykłady
Poniższy przykład tworzy zestaw jako CheckBox nieokreślony.The following example creates a CheckBox set to an indeterminate state.
<CheckBox Name="checkBox1" IsThreeState="True"
IsChecked="{x:Null}">
A CheckBox in an indeterminate state
</CheckBox>
Uwagi
Formant, który dziedziczy po ToggleButton określa jego zachowanie, gdy ta właściwość jest null
.A control that inherits from ToggleButton determines its behavior when this property is null
.
CheckBoxCheckBox
Gdy IsThreeState Właściwość jest ustawiona na wartość true, użytkownik może kliknąć, CheckBox Aby wybrać trzy możliwe stany.When the IsThreeState property is set to true, a user can click a CheckBox to pick three possible states. W poniższej tabeli opisano trzy stany CheckBox .The following table describes the three states of a CheckBox.
Stan CheckBoxState of the CheckBox | Wartość IsCheckedValue of IsChecked |
---|---|
ZaznaczonoChecked | true |
UncheckedUnchecked | false |
OkreślonaIndeterminate | null |
Jeśli IsThreeState ma wartość false, można nadal programowo ustawić tę właściwość w null
celu umieszczenia CheckBox w nieokreślonym stanie, ale użytkownik nie może ustawić CheckBox na nieokreślony stan za pomocą interfejs użytkownika (UI)user interface (UI) .If IsThreeState is false, you can still programmatically set this property to null
to put the CheckBox in an indeterminate state, but the user cannot set the CheckBox to the indeterminate state through the interfejs użytkownika (UI)user interface (UI).
RadioButtonRadioButton
Jeśli ustawisz tę właściwość na null
na RadioButton , RadioButton nie jest zaznaczone pole wyboru.If you set this property to null
on a RadioButton, the RadioButton is unchecked.
Użycie atrybutu języka XAMLXAML Attribute Usage
<obiekt IsChecked
= " Boolean "/><object IsChecked
="Boolean"/>
-lub--or-
<obiekt IsChecked
= "{X:null — Markup Extension}"/><object IsChecked
="{x:Null Markup Extension}"/>
Informacje dotyczące właściwości zależnościDependency Property Information
Pole identyfikatoraIdentifier field | IsCheckedProperty |
Właściwości metadanych ustawione na true Metadata properties set to true |
BindsTwoWayByDefault |