ClassRadButton
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
RadButton()
Declaration
public RadButton()
Properties
DialogResult
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.
Declaration
public DialogResult DialogResult { get; set; }
Property Value
One of the DialogResult enumeration values. The default is DialogResult.None.
Implements
Remarks
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.
EnableUIAutomation
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.
Declaration
public override bool EnableUIAutomation { get; set; }
Property Value
Overrides
Implements
Remarks
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
NotifyDefault(bool)
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.
Declaration
public void NotifyDefault(bool value)
Parameters
value
True if the button is to have the appearance of the default button; otherwise, false.
Implements
Remarks
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.
PerformClick()
Generates a Click event for the button, simulating a user click. This method can be called programmatically to trigger the button's click behavior.
Declaration
public override void PerformClick()
Overrides
Implements
Remarks
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.
ProcessCmdKey(ref Message, Keys)
Processes command keys for the button control.
Declaration
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
Parameters
msg
A Message, passed by reference, that represents the window message to process.
keyData
One of the Keys values that represents the key to process.
Returns
True if the command key was processed by this method; otherwise, false.
Overrides
ProcessCodedUIMessage(ref IPCMessage)
Processes Coded UI test messages for automated testing scenarios.
Declaration
protected override void ProcessCodedUIMessage(ref IPCMessage request)
Parameters
request
IPCMessage
The IPC message containing the test command and parameters.
Overrides
ResetBackColorThemeOverrides()
Resets theme value overrides for the BackColor property.
Declaration
protected override void ResetBackColorThemeOverrides()
Overrides
ResetForeColorThemeOverrides()
Resets theme value overrides for the ForeColor property, restoring default theme behavior.
Declaration
protected override void ResetForeColorThemeOverrides()
Overrides
SetBackColorThemeOverrides()
Sets theme value overrides for the BackColor property of the button.
Declaration
protected override void SetBackColorThemeOverrides()
Overrides
SetForeColorThemeOverrides()
Sets theme value overrides for the ForeColor property of the button.
Declaration
protected override void SetForeColorThemeOverrides()
Overrides
WndProc(ref Message)
Processes Windows messages sent to the control.
Declaration
protected override void WndProc(ref Message m)
Parameters
m
The Windows Message to process.
Overrides