English 中文(简体)
Silverlight - Buttons
  • 时间:2024-11-05

Silverpght - Buttons


Previous Page Next Page  

The Button class represents the most basic type of button control. Silverpght recognizes three types of button controls: the famipar 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 −

Hierarchical Inheritance Button

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

CpckMode

Gets or sets a value that indicates when the Cpck 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

HorizontalApgnment

Gets or sets the horizontal apgnment characteristics that are appped 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 estabpsh resource items as child object elements of a frameworkElement.Resources property element, through XAML imppcit collection syntax. (Inherited from FrameworkElement)

20

Style

Gets or sets an instance Style that is appped 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

VerticalApgnment

Gets or sets the vertical apgnment characteristics that are appped to a FrameworkElement when it is composed in a parent object such as a panel or items control. (Inherited from FrameworkElement)

23

Visibipty

Gets or sets the visibipty 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 apppcation 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

Cpck

Occurs when a button control is cpcked. (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 HyperpnkButton

The HyperpnkButton does not draw the standard button background. Instead, it simply renders the content that you supply.

2 ToggleButton & RepeatButton

RepeatButton control fires Cpck events continuously, as long as the button is held down. ToggleButton control represents a button that has two states (cpcked or uncpcked).

3 CheckBox

A control that a user can select (check) or de-select (uncheck). It provides a pst of options that a user can select, such as a pst of settings to apply to an apppcation.

4 RadioButton

The RadioButton is a button that allows a user to select a single option from a group of options.

Advertisements