开发手册 欢迎您!
软件开发者资料库

Silverlight - 按钮

Silverlight按钮 - 从概述,环境设置,入门,XAML概述,项目类型,固定布局,动态布局,约束与无约束布局,Silverlight和CSS,控件,按钮,内容模型,ListBox等简单易懂的步骤中学习Silverlight ,模板,视觉状态,数据绑定,浏览器集成,浏览器外应用程序,应用程序,资源和部署,文件访问,视图模型,输入处理,隔离存储,文本,动画,视频和音频,打印。

按钮类表示最基本的按钮控件类型. Silverlight识别三种类型的按钮控件:熟悉的按钮 CheckBox RadioButton .所有这些控件都是从 ButtonBase 派生的内容控件. Button类的层次继承如下 :

Hierarchical Inheritance Button

以下是按钮最常用的属性.

Sr. No.属性&描述
1

Background

获取或设置提供控件背景的画笔. (继承自Control)

2

BorderBrush

获取或设置描述控件边框填充的画笔. (继承自Control)

3

BorderThickness

获取或设置控件的边框粗细. (继承自Control)

4

Content

获取或设置ContentControl的内容. (继承自ContentControl)

5

ClickMode

获取或设置一个值,该值指示Click事件发生的时间,就设备行为而言. (继承自ButtonBase)

6

ContentTemplate

获取或设置用于显示ContentControl内容的数据模板. (继承自ContentControl)

7

FontFamily

获取或设置用于在控件中显示文本的字体. (继承自Control)

8

FontSize

获取或设置此控件中文本的大小. (继承自Control)

9

FontStyle

获取或设置呈现文本的样式. (继承自Control)

10

FontWeight

获取或设置指定字体的粗细. (继承自Control)

11

Foreground

获取或设置描述前景色的画笔. (继承自Control)

12

Height

获取或设置FrameworkElement的建议高度. (继承自FrameworkElement)

13

HorizontalAlignment

获取或设置在布局父级(例如面板或项控件)中组合时应用于FrameworkElement的水平对齐特征. (继承自FrameworkElement)

14

IsEnabled

获取或设置一个值,指示用户是否可以与控件进行交互. (继承自Control)

15

IsPressed

获取一个值,该值指示ButtonBase当前是否处于按下状态. (继承自ButtonBase)

16

Margin

获取或设置FrameworkElement的外边距. (继承自FrameworkElement)

17

Name

获取或设置对象的标识名称.当XAML处理器从XAML标记创建对象树时,运行时代码可以通过此名称引用XAMLdeclared对象. (继承自FrameworkElement)

18

Opacity

获取或设置对象的不透明度. (继承自UIElement)

19

Resources

获取本地定义的资源字典.在XAML中,您可以通过XAML隐式集合语法将资源项建立为frameworkElement.Resources属性元素的子对象元素. (继承自FrameworkElement)

20

Style

获取或设置在布局和渲染过程中应用于此对象的实例样式. (继承自FrameworkElement)

21

Template

获取或设置控件模板.控件模板在UI中定义控件的可视外观,并在XAML标记中定义. (继承自Control)

22

VerticalAlignment

获取或设置在父对象(如面板或项控件)中组合时应用于FrameworkElement的垂直对齐特征. (继承自FrameworkElement)

23

VerticalAlignment

获取或设置UIElement的可见性.不可见的UIElement不会呈现,也不会将其所需的大小传达给布局. (继承自UIElement)

24

Visibility

获取或设置FrameworkElement的宽度. (继承自FrameworkElement)

如下所示是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)


如下所示是Button常用的事件.


Sr. No.按钮&描述
1HyperlinkButton

HyperlinkButton不会绘制标准按钮背景.相反,它只是呈现您提供的内容.

2ToggleButton& RepeatButton

只要按住按钮,RepeatButton控件就会连续触发Click事件. ToggleButton控件表示一个具有两种状态(单击或未单击)的按钮.

3CheckBox

用户可以选择(检查)或取消的控件选择(取消选中).它提供了用户可以选择的选项列表,例如要应用于应用程序的设置列表.

4RadioButton

RadioButton是一个允许用户从一组选项中选择单个选项的按钮.