Class ToggleButton
Represent a UI toggle button. A toggle but can have two or three states depending on the IsThreeState property.
[DataContract("ToggleButton")]
[DataContractMetadataType(typeof(ToggleButton.ToggleButtonMetadata))]
public class ToggleButton : ButtonBase, IUIElementUpdate, IUIElementChildren, IIdentifiable
- Inheritance
-
ToggleButton
- Implements
- Inherited Members
- Extension Methods
Constructors
ToggleButton()
public ToggleButton()
Fields
CheckedEvent
Identifies the Checked routed event.
public static readonly RoutedEvent<RoutedEventArgs> CheckedEvent
Field Value
IndeterminateEvent
Identifies the Indeterminate routed event.
public static readonly RoutedEvent<RoutedEventArgs> IndeterminateEvent
Field Value
UncheckedEvent
Identifies the Unchecked routed event.
public static readonly RoutedEvent<RoutedEventArgs> UncheckedEvent
Field Value
Properties
CheckedImage
Gets or sets the image displayed when the button is checked.
[DataMember]
[Display(null, "Appearance")]
public ISpriteProvider CheckedImage { get; set; }
Property Value
IndeterminateImage
Gets or sets the image displayed when the button state is undeterminate.
[DataMember]
[Display(null, "Appearance")]
public ISpriteProvider IndeterminateImage { get; set; }
Property Value
IsThreeState
Determines whether the control supports two or three states.
[DataMember]
[Display(null, "Behavior")]
public bool IsThreeState { get; set; }
Property Value
Remarks
Setting IsThreeState to false changes the State of the toggle button if currently set to Indeterminate
State
Gets or sets the state of the ToggleButton
[DataMember]
[Display(null, "Behavior")]
public ToggleState State { get; set; }
Property Value
Remarks
Setting the state of the toggle button to Indeterminate sets IsThreeState to true.
UncheckedImage
Gets or sets the image displayed when the button is unchecked.
[DataMember]
[Display(null, "Appearance")]
public ISpriteProvider UncheckedImage { get; set; }
Property Value
Methods
GoToNextState()
Move the state of the toggle button to the next state. States order is: Unchecked -> Checked [-> Indeterminate] -> Unchecked -> ...
protected void GoToNextState()
OnClick(RoutedEventArgs)
The class handler of the event Click. This method can be overridden in inherited classes to perform actions common to all instances of a class.
protected override void OnClick(RoutedEventArgs args)
Parameters
args
RoutedEventArgsThe arguments of the event
OnToggleImageInvalidated()
Function triggered when one of the CheckedImage, IndeterminateImage and UncheckedImage images are invalidated. This function can be overridden in inherited classes.
protected virtual void OnToggleImageInvalidated()
Events
Checked
Occurs when a ToggleButton is checked.
public event EventHandler<RoutedEventArgs> Checked
Event Type
Remarks
A checked event is bubbling
Indeterminate
Occurs when a ToggleButton is Indeterminate.
public event EventHandler<RoutedEventArgs> Indeterminate
Event Type
Remarks
A Indeterminate event is bubbling
Unchecked
Occurs when a ToggleButton is Unchecked.
public event EventHandler<RoutedEventArgs> Unchecked
Event Type
Remarks
A Unchecked event is bubbling