RadButton
Represents a button control that responds to user clicks and provides comprehensive Windows Forms integration with dialog support and accessibility features. The button control serves as a RadButtonElement wrapper, implementing all logic and presentation features through a parallel hierarchy of objects. This allows RadButtonElement to be nested in any other Telerik control, item, or element for maximum flexibility.
Definition
Namespace:Telerik.WinControls.UI
Assembly:Telerik.WinControls.UI.dll
Syntax:
[DefaultBindingProperty("Text")]
public class RadButton : RadButtonBase, IDropTarget, ISynchronizeInvoke, IWin32Window, IBindableComponent, IComponent, IDisposable, INotifyPropertyChanged, ISupportInitializeNotification, ISupportInitialize, IComponentTreeHandler, ILayoutHandler, IAnalyticsProvider, IButtonControl, ISupportRootUIAutomation
Inheritance: objectMarshalByRefObjectComponentControlScrollableControlRadControlRadButtonBaseRadButton...
Derived Classes:
Implements:
Inherited Members
Constructors
public RadButton()
Properties
Gets or sets the dialog result value that is returned to the parent form when the button is clicked. This property is used to determine which button was clicked in modal dialogs. When a button with a DialogResult value is clicked, the form automatically closes and returns this value.
public DialogResult DialogResult { get; set; }
One of the DialogResult enumeration values. The default is DialogResult.None.
Implements:
This property is commonly used in dialog boxes to indicate the user's choice. Setting this property to any value other than DialogResult.None will cause the form to close when the button is clicked.
Gets or sets a value indicating whether UI Automation support is enabled for this button control. When enabled, screen readers and other accessibility tools can interact with the control. UI Automation provides programmatic access to user interface elements for assistive technology products.
public override bool EnableUIAutomation { get; set; }
Overrides:
Implements:
Disabling UI Automation may improve performance but will make the control inaccessible to screen readers. This property should typically remain enabled unless performance is critical and accessibility is not required.
Methods
Notifies the button whether it is the default button so that it can adjust its appearance accordingly. Default buttons typically have a thicker border or different visual styling to indicate their special status.
public void NotifyDefault(bool value)
True if the button is to have the appearance of the default button; otherwise, false.
Implements:
This method is typically called by the parent form to notify the button of its default status. Default buttons are activated when the user presses the Enter key within the form.
Generates a Click event for the button, simulating a user click. This method can be called programmatically to trigger the button's click behavior.
public override void PerformClick()
Overrides:
Implements:
This method checks if the Escape key is currently pressed and prevents the click if it is, unless this button is designated as the form's cancel button. This behavior ensures proper handling of dialog cancellation scenarios.
Processes command keys for the button control.
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
A Message, passed by reference, that represents the window message to process.
keyDataKeysOne of the Keys values that represents the key to process.
Returns:True if the command key was processed by this method; otherwise, false.
Overrides:
Processes Coded UI test messages for automated testing scenarios.
protected override void ProcessCodedUIMessage(ref IPCMessage request)
The IPC message containing the test command and parameters.
Overrides:
Resets theme value overrides for the BackColor property.
protected override void ResetBackColorThemeOverrides()
Overrides:
Resets theme value overrides for the ForeColor property, restoring default theme behavior.
protected override void ResetForeColorThemeOverrides()
Overrides:
Sets theme value overrides for the BackColor property of the button.
protected override void SetBackColorThemeOverrides()
Overrides:
Sets theme value overrides for the ForeColor property of the button.
protected override void SetForeColorThemeOverrides()
Overrides:
Processes Windows messages sent to the control.
protected override void WndProc(ref Message m)
The Windows Message to process.
Overrides: