Table of Contents

Class ToggleButton

Namespace
Stride.UI.Controls
Assembly
Stride.UI.dll

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

RoutedEvent<RoutedEventArgs>

IndeterminateEvent

Identifies the Indeterminate routed event.

public static readonly RoutedEvent<RoutedEventArgs> IndeterminateEvent

Field Value

RoutedEvent<RoutedEventArgs>

UncheckedEvent

Identifies the Unchecked routed event.

public static readonly RoutedEvent<RoutedEventArgs> UncheckedEvent

Field Value

RoutedEvent<RoutedEventArgs>

Properties

CheckedImage

Gets or sets the image displayed when the button is checked.

[DataMember]
[Display(null, "Appearance")]
public ISpriteProvider CheckedImage { get; set; }

Property Value

ISpriteProvider

IndeterminateImage

Gets or sets the image displayed when the button state is undeterminate.

[DataMember]
[Display(null, "Appearance")]
public ISpriteProvider IndeterminateImage { get; set; }

Property Value

ISpriteProvider

IsThreeState

Determines whether the control supports two or three states.

[DataMember]
[Display(null, "Behavior")]
public bool IsThreeState { get; set; }

Property Value

bool

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

ToggleState

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

ISpriteProvider

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 RoutedEventArgs

The 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

EventHandler<RoutedEventArgs>

Remarks

A checked event is bubbling

Indeterminate

Occurs when a ToggleButton is Indeterminate.

public event EventHandler<RoutedEventArgs> Indeterminate

Event Type

EventHandler<RoutedEventArgs>

Remarks

A Indeterminate event is bubbling

Unchecked

Occurs when a ToggleButton is Unchecked.

public event EventHandler<RoutedEventArgs> Unchecked

Event Type

EventHandler<RoutedEventArgs>

Remarks

A Unchecked event is bubbling