Class RadButtonItem
Represents a button item.
Inheritance
Inherited Members
Namespace: Telerik.WinControls.UI
Assembly: Telerik.WinControls.UI.dll
Syntax
public class RadButtonItem : RadItem, INotifyPropertyChanged, ICustomTypeDescriptor, ISupportSystemSkin, IComponent, IDisposable, IBindableComponent, ISupportDrag, ISupportDrop, IShortcutProvider, IStylableElement, IStylableNode, IButtonControl, IImageElement
Constructors
RadButtonItem()
Initializes a new instance of the RadButtonItem class.
Declaration
public RadButtonItem()
RadButtonItem(String)
Initializes a new instance of the RadButtonItem class and sets it's Text property to the provided string.
Declaration
public RadButtonItem(string text)
Parameters
|
System.String
text
The text to display on the button item. |
RadButtonItem(String, Image)
Initializes a new instance of the RadButtonItem class, sets it's Text and Image properties to the provided string and Image.
Declaration
public RadButtonItem(string text, Image image)
Parameters
|
System.String
text
The text to display on the button item. |
|
System.Drawing.Image
image
The image to display on the button item. |
Fields
DisplayStyleProperty
ImageAlignmentProperty
ImageIndexProperty
ImageKeyProperty
ImageProperty
IsDefaultProperty
IsPressedProperty
SvgImageProperty
TextAlignmentProperty
TextImageRelationProperty
Properties
DisplayStyle
Specifies the options for display of image and text primitives in the element.
Declaration
[RadPropertyDefaultValue("DisplayStyle", typeof(RadButtonItem))]
public virtual DisplayStyle DisplayStyle { get; set; }
Property Value
|
DisplayStyle
|
Image
Gets or sets the image that is displayed on a button element.
Declaration
[RadPropertyDefaultValue("Image", typeof(RadButtonItem))]
public virtual Image Image { get; set; }
Property Value
|
System.Drawing.Image
|
Implements
ImageAlignment
Gets or sets the alignment of image content on the drawing surface.
Declaration
[RadPropertyDefaultValue("ImageAlignment", typeof(RadButtonItem))]
public virtual ContentAlignment ImageAlignment { get; set; }
Property Value
|
System.Drawing.ContentAlignment
|
ImageIndex
Gets or sets the image list index value of the image displayed on the button control.
Declaration
[RadPropertyDefaultValue("ImageIndex", typeof(RadButtonItem))]
public virtual int ImageIndex { get; set; }
Property Value
|
System.Int32
|
Implements
ImageKey
Gets or sets the key accessor for the image in the ImageList.
Declaration
[RadPropertyDefaultValue("ImageKey", typeof(RadButtonItem))]
public virtual string ImageKey { get; set; }
Property Value
|
System.String
|
Implements
IsDefault
Determines if this button is the default button for the form it is on.
Declaration
public virtual bool IsDefault { get; set; }
Property Value
|
System.Boolean
|
IsPressed
Gets a value indicating whether the button item is in the pressed state.
Declaration
public virtual bool IsPressed { get; }
Property Value
|
System.Boolean
|
IsSharedImage
SvgImage
Gets or sets the vector image that is displayed on a button element.
Declaration
[RadPropertyDefaultValue("SvgImage", typeof(RadButtonItem))]
public RadSvgImage SvgImage { get; set; }
Property Value
|
RadSvgImage
|
SvgImageXml
This property is not relevant for this class as it's used internally for serialization purposes only.
Declaration
public string SvgImageXml { get; set; }
Property Value
|
System.String
|
TextAlignment
Gets or sets the alignment of text content on the drawing surface.
Declaration
[RadPropertyDefaultValue("TextAlignment", typeof(RadButtonItem))]
public virtual ContentAlignment TextAlignment { get; set; }
Property Value
|
System.Drawing.ContentAlignment
|
TextImageRelation
Gets or sets the position of text and image relative to each other.
Declaration
[RadPropertyDefaultValue("TextImageRelation", typeof(RadButtonItem))]
public virtual TextImageRelation TextImageRelation { get; set; }
Property Value
|
System.Windows.Forms.TextImageRelation
|
Methods
DisposeManagedResources()
Disposes managed resources, including the associated image if it's not shared with other items.
Declaration
protected override void DisposeManagedResources()
Overrides
InitializeFields()
Initializes the internal state fields for the button item, setting default values for shared image and capture behavior.
Declaration
protected override void InitializeFields()
Overrides
MapStyleProperty(RadProperty, String)
Maps a style property to the corresponding property in this element, enabling proper style inheritance and application.
Declaration
public override RadProperty MapStyleProperty(RadProperty propertyToMap, string settingType)
Parameters
|
RadProperty
propertyToMap
The RadProperty to map from the style. |
|
System.String
settingType
The type of setting being applied. |
Returns
|
RadProperty
The mapped RadProperty for this element, or null if no mapping exists. |
Overrides
OnClick(EventArgs)
Handles the click event, managing dialog result assignment and ensuring proper form behavior for button controls.
Declaration
protected override void OnClick(EventArgs e)
Parameters
|
System.EventArgs
e
The System.EventArgs containing event data. |
Overrides
OnDoubleClick(EventArgs)
Handles the double click event by delegating to the OnClick(EventArgs) method, treating double clicks as single clicks.
Declaration
protected override void OnDoubleClick(EventArgs e)
Parameters
|
System.EventArgs
e
The System.EventArgs containing event data. |
Overrides
OnKeyDown(KeyEventArgs)
Handles the key down event, managing button press state for Space and Enter keys, and handling Escape to cancel press.
Declaration
protected override void OnKeyDown(KeyEventArgs e)
Parameters
|
System.Windows.Forms.KeyEventArgs
e
The System.Windows.Forms.KeyEventArgs containing event data. |
Overrides
OnKeyUp(KeyEventArgs)
Handles the key up event, performing a click action when the Space key is released while the button is pressed.
Declaration
protected override void OnKeyUp(KeyEventArgs e)
Parameters
|
System.Windows.Forms.KeyEventArgs
e
The System.Windows.Forms.KeyEventArgs containing event data. |
Overrides
OnMouseDown(MouseEventArgs)
Handles the mouse down event by setting the button to pressed state and capturing mouse input when appropriate.
Declaration
protected override void OnMouseDown(MouseEventArgs e)
Parameters
|
System.Windows.Forms.MouseEventArgs
e
The System.Windows.Forms.MouseEventArgs containing event data. |
Overrides
OnMouseEnter(EventArgs)
Handles the mouse enter event by setting the button to pressed state when in hover click mode or when a press is pending.
Declaration
protected override void OnMouseEnter(EventArgs e)
Parameters
|
System.EventArgs
e
The System.EventArgs containing event data. |
Overrides
OnMouseLeave(EventArgs)
Handles the mouse leave event by releasing the pressed state and managing press-on-return behavior.
Declaration
protected override void OnMouseLeave(EventArgs e)
Parameters
|
System.EventArgs
e
The System.EventArgs containing event data. |
Overrides
OnMouseUp(MouseEventArgs)
Handles the mouse up event by releasing the pressed state and mouse capture.
Declaration
protected override void OnMouseUp(MouseEventArgs e)
Parameters
|
System.Windows.Forms.MouseEventArgs
e
The System.Windows.Forms.MouseEventArgs containing event data. |
Overrides
OnPropertyChanged(RadPropertyChangedEventArgs)
Handles property changes, specifically releasing the pressed state when the button is disabled.
Declaration
protected override void OnPropertyChanged(RadPropertyChangedEventArgs e)
Parameters
|
RadPropertyChangedEventArgs
e
The RadPropertyChangedEventArgs containing event data. |
Overrides
ShouldSerializeProperty(PropertyDescriptor)
Determines whether the specified property should be serialized, with special handling for the SvgImageXml property.
Declaration
public override bool? ShouldSerializeProperty(PropertyDescriptor property)
Parameters
|
System.ComponentModel.PropertyDescriptor
property
The System.ComponentModel.PropertyDescriptor representing the property to check for serialization. |
Returns
|
System.Nullable<System.Boolean>
True if the property should be serialized, false if it should not be serialized, or null for default behavior. |