Class 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.
Inherited Members
Namespace: Telerik.WinControls.UI
Assembly: Telerik.WinControls.UI.dll
Syntax
public class RadButton : RadButtonBase, INotifyPropertyChanged, ISupportInitializeNotification, ISupportInitialize, IComponentTreeHandler, ILayoutHandler, IPCHost, IAnalyticsProvider, IButtonControl, ISupportRootUIAutomation
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
System.Windows.Forms.DialogResult
One of the DialogResult enumeration values. The default is DialogResult.None. |
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
System.Boolean
|
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(Boolean)
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
System.Boolean
value
True if the button is to have the appearance of the default button; otherwise, false. |
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
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
System.Windows.Forms.Message
msg
A Message, passed by reference, that represents the window message to process. |
System.Windows.Forms.Keys
keyData
One of the Keys values that represents the key to process. |
Returns
System.Boolean
True if the command key was processed by this method; otherwise, false. |
ProcessCodedUIMessage(ref IPCMessage)
Processes Coded UI test messages for automated testing scenarios.
Declaration
protected override void ProcessCodedUIMessage(ref IPCMessage request)
Parameters
IPCMessage
request
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
System.Windows.Forms.Message
m
The Windows Message to process. |
Overrides
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
Gets the UI Automation Manager.
Declaration
IRootUIAutomationManager ISupportRootUIAutomation.RootUIAutomationManager { get; }
Returns
IRootUIAutomationManager
|
Implements
ISupportRootUIAutomation.UIAutomationProvider
Gets the UI Automation Provider.
Declaration
IRadRawElementProviderFragmentRoot ISupportRootUIAutomation.UIAutomationProvider { get; }
Returns
IRadRawElementProviderFragmentRoot
|