ClassRadToggleButtonElement
Represents a toggle button element. The toggle button supports two or three states depending on the IsThreeState property.
The RadToggleButton class is a simple wrapper for the RadToggleButtonElement class. All UI and logic functionality is implemented in the RadToggleButtonElement class. The RadToggleButton acts to transfer events to and from its corresponding RadToggleButtonElement instance. The latter can be nested in other telerik controls.
Definition
Namespace:Telerik.WinControls.UI
Assembly:Telerik.WinControls.UI.dll
Syntax:
public class RadToggleButtonElement : RadButtonElement, INotifyPropertyChanged, ICustomTypeDescriptor, ISupportSystemSkin, IBindableComponent, IComponent, IDisposable, ISupportDrag, ISupportDrop, IShortcutProvider, IStylableElement, IStylableNode, IButtonControl, IImageElement
Inheritance: objectDisposableObjectRadObjectRadElementVisualElementRadComponentElementRadItemRadButtonItemRadButtonElementRadToggleButtonElement
Derived Classes:
Implements:
Inherited Members
Constructors
RadToggleButtonElement()
Declaration
public RadToggleButtonElement()
Fields
CheckedRoutedEvent
Identifies the Checked routed event.
Indeterminate
Identifies the Indeterminate routed event.
ToggleStateChangingRoutedEvent
Identifies the ToggleStateChanging routed event.
Declaration
public static RoutedEvent ToggleStateChangingRoutedEvent
Field Value
ToggleStateProperty
Identifies the ToggleState dependency property.
Unchecked
Identifies the Unchecked routed event.
Properties
CheckState
Gets or sets the check state of the toggle button using CheckState enumeration. CheckState enumeration defines the following values: Unchecked, Checked, and Indeterminate.
Declaration
[Browsable(true)]
[Bindable(true)]
public CheckState CheckState { get; set; }
Property Value
IsChecked
Gets or sets a value indicating whether the button is checked. Returns true if the toggle state is not Off; otherwise, false.
Declaration
[Browsable(false)]
[Bindable(true)]
public bool IsChecked { get; set; }
Property Value
IsThreeState
Gets or sets a value indicating whether the toggle button has three or two states. When true, the button supports Checked, Unchecked, and Indeterminate states.
Declaration
[Browsable(true)]
[Bindable(true)]
public bool IsThreeState { get; set; }
Property Value
ReadOnly
Gets or sets a value indicating whether the toggle button element is read only. When read-only, the button cannot be toggled by user interaction but can still be changed programmatically.
Declaration
[Browsable(true)]
public bool ReadOnly { get; set; }
Property Value
true if the toggle button element is read only; otherwise, false.
ToggleState
Gets or sets the toggle state of the button using ToggleState enumeration. Toggle state enumeration defines the following values: Off, Indeterminate, and On.
Declaration
[Browsable(true)]
[Bindable(true)]
public ToggleState ToggleState { get; set; }
Property Value
Methods
CreateChildElements()
Creates the child elements of the toggle button.
Declaration
protected override void CreateChildElements()
Overrides
GetXPVisualStyle()
Gets the visual style element for Windows XP theme rendering based on the current state of the toggle button.
Declaration
public override VisualStyleElement GetXPVisualStyle()
Returns
The VisualStyleElement corresponding to the current state of the toggle button.
Overrides
OnCheckStateChanged(EventArgs)
Raises the CheckStateChanged event.
OnCheckStateChanging(CheckStateChangingEventArgs)
Raises the CheckStateChanging event.
Declaration
protected virtual void OnCheckStateChanging(CheckStateChangingEventArgs e)
Parameters
e
A CheckStateChangingEventArgs that contains the event data.
OnClick(EventArgs)
Handles the Click event and performs toggle if not in read-only mode.
OnIsCheckedChanged(EventArgs)
Raises the IsCheckedChanged event.
OnToggle()
Performs the toggle operation by changing the toggle state based on the current state and whether three-state mode is enabled.
Declaration
protected virtual void OnToggle()
OnToggleStateChanged(StateChangedEventArgs)
Raises the StateChanged event.
Declaration
protected virtual void OnToggleStateChanged(StateChangedEventArgs e)
Parameters
e
A StateChangedEventArgs that contains the event data.
OnToggleStateChanging(StateChangingEventArgs)
Raises the StateChanging event and checks if the indeterminate state is allowed.
Declaration
protected virtual void OnToggleStateChanging(StateChangingEventArgs e)
Parameters
e
A StateChangingEventArgs that contains the event data.
SetToggleState(ToggleState)
Sets the toggle state of the button by calling the core implementation.
Declaration
protected virtual void SetToggleState(ToggleState value)
Parameters
value
The new toggle state value to set.
Events
CheckStateChanged
Occurs when the elements's check state changes.
Declaration
[Browsable(true)]
public event EventHandler CheckStateChanged
Event Value
CheckStateChanging
Occurs before the elements's check state changes.
Declaration
[Browsable(true)]
public event CheckStateChangingEventHandler CheckStateChanging
Event Value
ToggleStateChanged
Occurs when the elements's state changes.
Declaration
[Browsable(true)]
public event StateChangedEventHandler ToggleStateChanged
Event Value
ToggleStateChanging
Occurs before the elements's state changes.
Declaration
[Browsable(true)]
public event StateChangingEventHandler ToggleStateChanging
Event Value