Class RadToggleButton
Represents a RadToggleButton. A ToggleButton may have the following states: On, Off, and Indeterminate. The button may have only the first two states if the IsThreeState property is set to false.
The RadToggleButton class is a simple wrapper for the RadToggleButtonElement. All UI and logic functionality is implemented in the RadToggleButtonElement class. The latter can be nested in other telerik controls. RadToggleButton acts to transfer events to and from the its corresponding RadToggleButtonElement instance.
Inherited Members
Namespace: Telerik.WinControls.UI
Assembly: Telerik.WinControls.UI.dll
Syntax
public class RadToggleButton : RadButtonBase, INotifyPropertyChanged, ISupportInitializeNotification, ISupportInitialize, IComponentTreeHandler, ILayoutHandler, IPCHost, IAnalyticsProvider, ISupportRootUIAutomation
Constructors
RadToggleButton()
Initializes a new instance of the RadToggleButton class. Creates a toggle button with default settings and unchecked state.
Declaration
public RadToggleButton()
Properties
ButtonElement
Gets the RadToggleButtonElement that represents the visual element of this toggle button control. This element contains the visual styling and behavior logic for the toggle button.
Declaration
public RadToggleButtonElement ButtonElement { get; }
Property Value
RadToggleButtonElement
A RadToggleButtonElement that represents the button's visual element. |
CheckState
Gets or sets the check state of the toggle button using CheckState enumeration. Supports three states: Checked, Unchecked, and Indeterminate (when IsThreeState is true).
Declaration
public CheckState CheckState { get; set; }
Property Value
System.Windows.Forms.CheckState
One of the CheckState enumeration values. |
DefaultSize
Gets the default size for the toggle button control.
Declaration
protected override Size DefaultSize { get; }
Property Value
System.Drawing.Size
|
Overrides
EnableUIAutomation
Gets or sets a value indicating whether UI Automation support is enabled for this toggle button. Enables accessibility features for screen readers and other assistive technologies.
Declaration
public override bool EnableUIAutomation { get; set; }
Property Value
System.Boolean
true if UI Automation is enabled; otherwise, false. |
Overrides
Implements
IsChecked
Gets or sets a value indicating whether the toggle button is in the checked state. This is a simplified boolean representation of the button's toggle state.
Declaration
[RadDefaultValue("IsChecked", typeof(RadToggleButtonElement))]
public virtual bool IsChecked { get; set; }
Property Value
System.Boolean
true if the button is checked; otherwise, false. |
IsThreeState
Gets or sets a value indicating whether the toggle button supports three states. When true, the button can have Checked, Unchecked, and Indeterminate states.
Declaration
[RadDefaultValue("IsThreeState", typeof(RadToggleButtonElement))]
public bool IsThreeState { get; set; }
Property Value
System.Boolean
true if the button supports three states; otherwise, false. |
ReadOnly
Gets or sets a value indicating whether the toggle button is in read-only mode. When read-only, the button cannot be toggled by user interaction but can still be changed programmatically.
Declaration
public bool ReadOnly { get; set; }
Property Value
System.Boolean
true if the button is read-only; otherwise, false. |
ToggleState
Gets or sets the toggle state of the button using the ToggleState enumeration. This property provides more granular control over the button's state than IsChecked.
Declaration
[RadDefaultValue("ToggleState", typeof(RadToggleButtonElement))]
public ToggleState ToggleState { get; set; }
Property Value
ToggleState
One of the ToggleState enumeration values (Off, On, Indeterminate). |
Methods
ButtonElement_ToggleStateChanged(Object, StateChangedEventArgs)
Handles the ToggleStateChanged event from the underlying button element and forwards it to the control's event.
Declaration
protected virtual void ButtonElement_ToggleStateChanged(object sender, StateChangedEventArgs args)
Parameters
System.Object
sender
The source of the event. |
StateChangedEventArgs
args
A StateChangedEventArgs that contains the event data. |
ButtonElement_ToggleStateChanging(Object, StateChangingEventArgs)
Handles the ToggleStateChanging event from the underlying button element and forwards it to the control's event.
Declaration
protected virtual void ButtonElement_ToggleStateChanging(object sender, StateChangingEventArgs args)
Parameters
System.Object
sender
The source of the event. |
StateChangingEventArgs
args
A StateChangingEventArgs that contains the event data. |
CreateAccessibilityInstance()
Creates an accessibility instance for the toggle button to support assistive technologies.
Declaration
protected override AccessibleObject CreateAccessibilityInstance()
Returns
System.Windows.Forms.AccessibleObject
An System.Windows.Forms.AccessibleObject that provides accessibility support for the toggle button. |
Overrides
CreateButtonElement()
Create main button element that is specific for RadToggleButton.
Declaration
protected override RadButtonElement CreateButtonElement()
Returns
RadButtonElement
The element that encapsulates the functionality of RadToggleButton |
Overrides
CreateChildItems(RadElement)
Creates the child items for the toggle button and establishes event handlers with the underlying button element.
Declaration
protected override void CreateChildItems(RadElement parent)
Parameters
RadElement
parent
The parent RadElement that will contain the child items. |
Overrides
InitializeUIAutomationProvider()
Initializes and returns the UI Automation provider for this toggle button control.
Declaration
protected virtual IRadRawElementProviderFragmentRoot InitializeUIAutomationProvider()
Returns
IRadRawElementProviderFragmentRoot
An IRadRawElementProviderFragmentRoot that provides UI Automation support. |
OnCheckStateChanged(EventArgs)
Raises the CheckStateChanged event.
Declaration
protected virtual void OnCheckStateChanged(EventArgs e)
Parameters
System.EventArgs
e
An System.EventArgs that contains the event data. |
OnCheckStateChanging(CheckStateChangingEventArgs)
Raises the CheckStateChanging event.
Declaration
protected virtual void OnCheckStateChanging(CheckStateChangingEventArgs e)
Parameters
CheckStateChangingEventArgs
e
A CheckStateChangingEventArgs that contains the event data. |
OnToggleChanged(EventArgs)
Called when the toggle state changes to provide a common event handling point for derived classes.
Declaration
protected virtual void OnToggleChanged(EventArgs e)
Parameters
System.EventArgs
e
An System.EventArgs that contains the event data. |
OnToggleStateChanged(EventArgs)
Raises the StateChanged event.
Declaration
protected virtual void OnToggleStateChanged(EventArgs e)
Parameters
System.EventArgs
e
An System.EventArgs that contains the event data. |
OnToggleStateChanging(StateChangingEventArgs)
Raises the StateChanging event.
Declaration
protected virtual void OnToggleStateChanging(StateChangingEventArgs e)
Parameters
StateChangingEventArgs
e
A StateChangingEventArgs that contains the event data. |
res_CheckStateChanged(Object, EventArgs)
Handles the CheckStateChanged event from the underlying button element and forwards it to the control's event.
Declaration
protected virtual void res_CheckStateChanged(object sender, EventArgs e)
Parameters
System.Object
sender
The source of the event. |
System.EventArgs
e
An System.EventArgs that contains the event data. |
res_CheckStateChanging(Object, CheckStateChangingEventArgs)
Handles the CheckStateChanging event from the underlying button element and forwards it to the control's event.
Declaration
protected virtual void res_CheckStateChanging(object sender, CheckStateChangingEventArgs args)
Parameters
System.Object
sender
The source of the event. |
CheckStateChangingEventArgs
args
A CheckStateChangingEventArgs that contains the event data. |
res_PropertyChanged(Object, PropertyChangedEventArgs)
Handles property changes from the underlying button element, specifically for the IsChecked property.
Declaration
protected virtual void res_PropertyChanged(object sender, PropertyChangedEventArgs e)
Parameters
System.Object
sender
The source of the event. |
System.ComponentModel.PropertyChangedEventArgs
e
A System.ComponentModel.PropertyChangedEventArgs that contains the event data. |
ResetBackColorThemeOverrides()
Resets the background color theme overrides to their default values.
Declaration
protected override void ResetBackColorThemeOverrides()
Overrides
ResetForeColorThemeOverrides()
Resets the forecolor theme overrides to their default values.
Declaration
protected override void ResetForeColorThemeOverrides()
Overrides
SetBackColorThemeOverrides()
Sets theme overrides for the background color property across all visual states of the button element.
Declaration
protected override void SetBackColorThemeOverrides()
Overrides
SetForeColorThemeOverrides()
Sets theme overrides for the forecolor property across all visual states of the button element.
Declaration
protected override void SetForeColorThemeOverrides()
Overrides
WndProc(ref Message)
Processes Windows messages and handles UI Automation and control lifecycle messages.
Declaration
protected override void WndProc(ref Message m)
Parameters
System.Windows.Forms.Message
m
The Windows System.Windows.Forms.Message to process. |
Overrides
Events
CheckStateChanged
Occurs after the check state has changed. This event is fired after the CheckState property has been updated.
Declaration
public event EventHandler CheckStateChanged
Event Type
System.EventHandler
|
CheckStateChanging
Occurs before the check state changes, providing an opportunity to cancel the change. Event handlers can validate the new state and cancel if necessary.
Declaration
public event CheckStateChangingEventHandler CheckStateChanging
Event Type
CheckStateChangingEventHandler
|
ToggleStateChanged
Occurs after the toggle state has changed. This event is fired after the ToggleState property has been updated to its new value.
Declaration
public event StateChangedEventHandler ToggleStateChanged
Event Type
StateChangedEventHandler
|
ToggleStateChanging
Occurs before the toggle state changes, allowing the change to be cancelled. Event handlers can set the Cancel property of the event args to prevent the state change.
Declaration
public event StateChangingEventHandler ToggleStateChanging
Event Type
StateChangingEventHandler
|
Explicit Interface Implementations
ISupportRootUIAutomation.DisposeUIAutomationProvider()
Clears the UI Automation provider for this control.
Declaration
void ISupportRootUIAutomation.DisposeUIAutomationProvider()
Implements
ISupportRootUIAutomation.InitializeUIAutomationProvider()
Creates the UI Automation provider for this control.
Declaration
void ISupportRootUIAutomation.InitializeUIAutomationProvider()
Implements
ISupportRootUIAutomation.RootUIAutomationManager
Declaration
IRootUIAutomationManager ISupportRootUIAutomation.RootUIAutomationManager { get; }
Returns
IRootUIAutomationManager
|
Implements
ISupportRootUIAutomation.UIAutomationProvider
Declaration
IRadRawElementProviderFragmentRoot ISupportRootUIAutomation.UIAutomationProvider { get; }
Returns
IRadRawElementProviderFragmentRoot
|