ClassRadButtonElement
Represents a button element. The button element could be placed in each control's Items collection. It encapsulates all the necessary logic related to the user interaction and UI. The RadButton class is a simple wrapper for the RadButtonElement class. The RadButton acts to transfer events to and from its corresponding RadButtonElement instance. The RadButtonElement which is essentially the RadButton control may be nested in other telerik controls.
Definition
Namespace:Telerik.WinControls.UI
Assembly:Telerik.WinControls.UI.dll
Syntax:
[ComVisible(false)]
public class RadButtonElement : RadButtonItem, INotifyPropertyChanged, ICustomTypeDescriptor, ISupportSystemSkin, IBindableComponent, IComponent, IDisposable, ISupportDrag, ISupportDrop, IShortcutProvider, IStylableElement, IStylableNode, IButtonControl, IImageElement
Inheritance: objectDisposableObjectRadObjectRadElementVisualElementRadComponentElementRadItemRadButtonItemRadButtonElement
Derived Classes:
Implements:
Inherited Members
Constructors
RadButtonElement()
Initializes a new instance of the RadButtonElement class.
Declaration
public RadButtonElement()
RadButtonElement(string)
Initializes a new instance of the RadButtonElement class with the specified text.
Declaration
public RadButtonElement(string text)
Parameters
text
The text to display on the button element.
RadButtonElement(string, Image)
Initializes a new instance of the RadButtonElement class with the specified text and image.
Fields
LargeImageIndexProperty
Identifies the LargeImageIndex property.
Declaration
public static RadProperty LargeImageIndexProperty
Field Value
LargeImageKeyProperty
Identifies the LargeImageKey property.
Declaration
public static RadProperty LargeImageKeyProperty
Field Value
LargeImageProperty
Identifies the LargeImage property.
SmallImageIndexProperty
Identifies the SmallImageIndex property.
Declaration
public static RadProperty SmallImageIndexProperty
Field Value
SmallImageKeyProperty
Identifies the SmallImageKey property.
Declaration
public static RadProperty SmallImageKeyProperty
Field Value
SmallImageProperty
Identifies the SmallImage property.
UseSmallImageListProperty
Identifies the UseSmallImageList property.
Declaration
public static RadProperty UseSmallImageListProperty
Field Value
Properties
BorderElement
Gets or sets the BorderPrimitive element that is responsible for painting the border of the button control.
Declaration
[Browsable(true)]
public BorderPrimitive BorderElement { get; protected set; }
Property Value
ButtonFillElement
Gets or sets the FillPrimitive element that is responsible for painting the background of the button control.
Declaration
[Browsable(true)]
public FillPrimitive ButtonFillElement { get; protected set; }
Property Value
FocusPrimitive
Gets a reference to the FocusPrimitive element that handles focus indication for the RadButtonElement.
Declaration
[Browsable(false)]
public FocusPrimitive FocusPrimitive { get; }
Property Value
ImagePrimitive
Gets or sets a reference to the ImagePrimitive element that handles image rendering for the RadButtonElement.
Declaration
[Browsable(false)]
public ImagePrimitive ImagePrimitive { get; protected set; }
Property Value
ImagePrimitiveAngleTransform
Gets or sets the angle of rotation for the button image in degrees. Unlike AngleTransform, the ImagePrimitiveAngleTransform property rotates only the image element, not the entire button.
Declaration
public float ImagePrimitiveAngleTransform { get; set; }
Property Value
LargeImage
Gets the large image that is displayed on the button element. This property is read-only and retrieves the image from the associated ImageList.
Declaration
[Browsable(false)]
[TypeConverter(typeof(ImageTypeConverter))]
public virtual Image LargeImage { get; }
Property Value
LargeImageIndex
Gets the large image list index value of the image displayed on the button control. This property is read-only and represents the index in the associated large ImageList.
Declaration
[Browsable(false)]
[RelatedImageList("ElementTree.Control.ImageList")]
[TypeConverter("Telerik.WinControls.UI.Design.NoneExcludedImageIndexConverter, Telerik.WinControls.UI.Design, Version=2026.1.217.48, Culture=neutral, PublicKeyToken=5bb2a467cbec794e")]
public virtual int LargeImageIndex { get; }
Property Value
LargeImageKey
Gets the large key accessor for the image in the ImageList. This property is read-only and represents the string key used to identify the image in the associated large ImageList.
Declaration
[Browsable(false)]
[TypeConverter("Telerik.WinControls.UI.Design.RadImageKeyConverter, Telerik.WinControls.UI.Design, Version=2026.1.217.48, Culture=neutral, PublicKeyToken=5bb2a467cbec794e")]
public virtual string LargeImageKey { get; }
Property Value
LayoutPanel
Gets or sets a reference to the ImageAndTextLayoutPanel that manages the layout and positioning of image and text elements within the button.
Declaration
[Browsable(false)]
public ImageAndTextLayoutPanel LayoutPanel { get; protected set; }
Property Value
MeasureTrailingSpaces
Gets or sets a value indicating whether trailing spaces at the end of each line should be included in text measurement. By default, the Graphics.MeasureString method excludes trailing spaces. Setting this to true includes that space in measurement calculations.
ShowBorder
Gets or sets a value indicating whether the border is visible around the button. When true, the border is displayed; when false, the border is collapsed and not visible.
Declaration
[Browsable(true)]
public bool ShowBorder { get; set; }
Property Value
SmallImage
Gets or sets the small image that is displayed on the button element. This property allows direct assignment of an Image object to be displayed.
Declaration
[TypeConverter(typeof(ImageTypeConverter))]
public virtual Image SmallImage { get; set; }
Property Value
SmallImageIndex
Gets or sets the small image list index value of the image displayed on the button control. This property specifies the index of the image in the associated small ImageList.
Declaration
[RelatedImageList("ElementTree.Control.SmallImageList")]
[TypeConverter("Telerik.WinControls.UI.Design.NoneExcludedImageIndexConverter, Telerik.WinControls.UI.Design, Version=2026.1.217.48, Culture=neutral, PublicKeyToken=5bb2a467cbec794e")]
public virtual int SmallImageIndex { get; set; }
Property Value
SmallImageKey
Gets or sets the small key accessor for the image in the ImageList. This property specifies the string key used to identify the image in the associated small ImageList.
Declaration
[RelatedImageList("ElementTree.Control.SmallImageList")]
[TypeConverter("Telerik.WinControls.UI.Design.RadImageKeyConverter, Telerik.WinControls.UI.Design, Version=2026.1.217.48, Culture=neutral, PublicKeyToken=5bb2a467cbec794e")]
public virtual string SmallImageKey { get; set; }
Property Value
TextElement
Gets or sets the TextPrimitive element that is responsible for rendering the text content of the button control.
Declaration
[Browsable(true)]
public TextPrimitive TextElement { get; protected set; }
Property Value
TextWrap
Gets or sets a value indicating whether the text should wrap to the available layout rectangle. When true, text will wrap to multiple lines within the button's bounds; when false, text remains on a single line.
UseSmallImageList
Gets or sets a value indicating whether the button should use the small image list instead of the original image list. When set to true, images are retrieved from the SmallImageList; when false, images are retrieved from the standard ImageList.
Declaration
[Browsable(false)]
public virtual bool UseSmallImageList { get; set; }
Property Value
Methods
CreateChildElements()
Creates the child elements that compose the button structure including fill, border, text, image, layout panel, and focus primitives. This method establishes the visual hierarchy and property bindings between the child elements.
Declaration
protected override void CreateChildElements()
Overrides
GetVistaVisualStyle()
Gets the appropriate VisualStyleElement based on the current button state.
Declaration
public override VisualStyleElement GetVistaVisualStyle()
Returns
A VisualStyleElement that represents the current visual state of the button.
Overrides
GetXPVisualStyle()
Declaration
public override VisualStyleElement GetXPVisualStyle()
Returns
Overrides
InitializeFields()
Initializes the fields of the RadButtonElement.
Declaration
protected override void InitializeFields()
Overrides
InitializeSystemSkinPaint()
Initializes system skin painting by updating text color to match system theme requirements. This method configures the text primitive's foreground color based on the current system skin manager settings.
Declaration
protected override void InitializeSystemSkinPaint()
Overrides
MeasureButtonChildren(SizeF)
Measures the child elements of the button and calculates the total required size based on AutoSize behavior and layout constraints.
MeasureOverride(SizeF)
Measures the desired size of the button element within the given available space constraints.
OnClick(EventArgs)
Handles the click event for the button element. This method ensures only left mouse button clicks are processed.
Declaration
protected override void OnClick(EventArgs e)
Parameters
e
The event arguments containing information about the click event.
Overrides
ShouldPaintChild(RadElement)
Determines whether a specific child element should be painted when system skin rendering is enabled.
Declaration
protected override bool ShouldPaintChild(RadElement element)
Parameters
element
The child element to evaluate for painting.
Returns
True if the element should be painted; false if it should be skipped during the paint operation.
Overrides