the button class represents the most basic type of button control. silverlight recognizes three types of button controls: the familiar button, the checkbox, and the radiobutton. all of these controls are content controls that are derived from buttonbase. the hierarchical inheritance of button class is as follows −

given below are the most commonly used properties of a button.
sr. no. | property & description |
---|---|
1 |
background gets or sets a brush that provides the background of the control. (inherited from control) |
2 |
borderbrush gets or sets a brush that describes the border fill of a control. (inherited from control) |
3 |
borderthickness gets or sets the border thickness of a control. (inherited from control) |
4 |
content gets or sets the content of a contentcontrol. (inherited from contentcontrol) |
5 |
clickmode gets or sets a value that indicates when the click event occurs, in terms of device behavior. (inherited from buttonbase) |
6 |
contenttemplate gets or sets the data template that is used to display the content of the contentcontrol. (inherited from contentcontrol) |
7 |
fontfamily gets or sets the font used to display text in the control. (inherited from control) |
8 |
fontsize gets or sets the size of the text in this control. (inherited from control) |
9 |
fontstyle gets or sets the style in which the text is rendered. (inherited from control) |
10 |
fontweight gets or sets the thickness of the specified font. (inherited from control) |
11 |
foreground gets or sets a brush that describes the foreground color. (inherited from control) |
12 |
height gets or sets the suggested height of a frameworkelement. (inherited from frameworkelement) |
13 |
horizontalalignment gets or sets the horizontal alignment characteristics that are applied to a frameworkelement when it is composed in a layout parent, such as a panel or items control. (inherited from frameworkelement) |
14 |
isenabled gets or sets a value indicating whether the user can interact with the control. (inherited from control) |
15 |
ispressed gets a value that indicates whether a buttonbase is currently in a pressed state. (inherited from buttonbase) |
16 |
margin gets or sets the outer margin of a frameworkelement. (inherited from frameworkelement) |
17 |
name gets or sets the identifying name of the object. when a xaml processor creates the object tree from xaml markup, run-time code can refer to the xamldeclared object by this name. (inherited from frameworkelement) |
18 |
opacity gets or sets the degree of the object's opacity. (inherited from uielement) |
19 |
resources gets the locally defined resource dictionary. in xaml, you can establish resource items as child object elements of a frameworkelement.resources property element, through xaml implicit collection syntax. (inherited from frameworkelement) |
20 |
style gets or sets an instance style that is applied for this object during layout and rendering. (inherited from frameworkelement) |
21 |
template gets or sets a control template. the control template defines the visual appearance of a control in ui, and is defined in xaml markup. (inherited from control) |
22 |
verticalalignment gets or sets the vertical alignment characteristics that are applied to a frameworkelement when it is composed in a parent object such as a panel or items control. (inherited from frameworkelement) |
23 |
visibility gets or sets the visibility of a uielement. a uielement that is not visible is not rendered and does not communicate its desired size to layout. (inherited from uielement) |
24 |
width gets or sets the width of a frameworkelement. (inherited from frameworkelement) |
given below are the commonly used methods of button.
sr. no. | method & description |
---|---|
1 |
clearvalue clears the local value of a dependency property. (inherited from dependencyobject) |
2 |
findname retrieves an object that has the specified identifier name. (inherited from frameworkelement) |
3 |
onapplytemplate invoked whenever application code or internal processes (such as a rebuilding layout pass) call applytemplate. in simplest terms, this means the method is called just before a ui element displays in your app. override this method to influence the default post-template logic of a class. (inherited from frameworkelement) |
4 |
oncontentchanged invoked when the value of the content property changes. (inherited from contentcontrol) |
5 |
ondragenter called before the dragenter event occurs. (inherited from control) |
6 |
ondragleave called before the dragleave event occurs. (inherited from control) |
7 |
ondragover called before the dragover event occurs. (inherited from control) |
8 |
ondrop called before the drop event occurs. (inherited from control) |
9 |
ongotfocus called before the gotfocus event occurs. (inherited from control) |
10 |
onkeydown called before the keydown event occurs. (inherited from control) |
11 |
onkeyup called before the keyup event occurs. (inherited from control) |
12 |
onlostfocus called before the lostfocus event occurs. (inherited from control) |
13 |
setbinding attaches a binding to a frameworkelement, using the provided binding object. (inherited from frameworkelement) |
given below are the commonly used events of button.
sr. no. | event & description |
---|---|
1 |
click occurs when a button control is clicked. (inherited from buttonbase) |
2 |
datacontextchanged occurs when the value of the frameworkelement.datacontext property changes. (inherited from frameworkelement) |
3 |
dragenter occurs when the input system reports an underlying drag event with this element as the target. (inherited from uielement) |
4 |
dragleave occurs when the input system reports an underlying drag event with this element as the origin. (inherited from uielement) |
5 |
dragover occurs when the input system reports an underlying drag event with this element as the potential drop target. (inherited from uielement) |
6 |
dragstarting occurs when a drag operation is initiated. (inherited from uielement) |
7 |
gotfocus occurs when a uielement receives focus. (inherited from uielement) |
8 |
holding occurs when an otherwise unhandled hold interaction occurs over the hit test area of this element. (inherited from uielement) |
9 |
isenabledchanged occurs when the isenabled property changes. (inherited from control) |
10 |
keydown occurs when a keyboard key is pressed while the uielement has focus. (inherited from uielement) |
11 |
keyup occurs when a keyboard key is released while the uielement has focus. (inherited from uielement) |
12 |
lostfocus occurs when a uielement loses focus. (inherited from uielement) |
13 |
sizechanged occurs when either the actualheight or the actualwidth property changes value on a frameworkelement. (inherited from frameworkelement) |
sr. no. | buttons & description |
---|---|
1 |
hyperlinkbutton
the hyperlinkbutton does not draw the standard button background. instead, it simply renders the content that you supply. |
2 |
togglebutton & repeatbutton
repeatbutton control fires click events continuously, as long as the button is held down. togglebutton control represents a button that has two states (clicked or unclicked). |
3 |
checkbox
a control that a user can select (check) or de-select (uncheck). it provides a list of options that a user can select, such as a list of settings to apply to an application. |
4 |
radiobutton
the radiobutton is a button that allows a user to select a single option from a group of options. |