- 浏览: 34510 次
- 性别:
- 来自: 北京
文章分类
最新评论
路由事件浏览
(1)在vs designer中,如在窗口中增加一个按钮,命名为MyButton,双击它,那么
它的xaml声明<Button Name="myButton" Click="myButton_Click">Click Me</Button>会在指明事件处理程序的那个对象上,直接产生一个健全的事件挂钩;
(2)这可以通过观察以下文件来验证:
class constructor-右击InitializeComponent方法-Go To Definition-生成的代码文件(.i.g.cs)-Connect方法
#line 6 "..\..\Window1.xaml" this.myButton.Click += new System.Windows.RoutedEventHandler( this.myButton_Click);
(3)窗口页后文件的Click处理程序:
private void myButton_Click( object sender, RoutedEventArgs e) { }
这看起来与任何其它的 .NET 事件挂接一样——有一个显式声明的委托,它挂接到一个对象事件而委托指向一个处理方法。
WPF的元素复合模型
WPF元素树
在窗口上拖放一个按钮的树是这样的:<Window> <Grid> <Button/> </Grid> </Window>它们每个元素都表示运行时对应的 .NET类型 一个实例;
待续
发表评论
-
wpf应用实例
2010-07-24 15:45 1037使用WPF快速创建可拖拽的对象和窗体。 -
业务流的前端,intel终极理想:感应终端环境与任意平面成屏技术
2010-07-08 12:44 986在欧美等人力成本高 ... -
wpf 研习1-24小时自学wpf16
2010-06-15 23:21 1341Visualizing Lists-displaying mo ... -
wpf 研习1-24小时自学wpf15
2010-06-14 23:25 888deeper into data binding ad ... -
wpf 研习1-24小时自学wpf14
2010-06-13 10:27 1358Resources and Styles 从下图,我们 ... -
wpf 研习1-24小时自学wpf13
2010-06-11 23:04 881Presenters and Views-the Shell ... -
wpf 研习1-24小时自学wpf12
2010-06-11 14:26 739A Contact Manager Choosin ... -
wpf 研习1-24小时自学wpf11
2010-06-10 15:02 941output WPF Document Con ... -
wpf 研习1-24小时自学wpf10
2010-06-09 16:25 936Commands In WPF, a command is ... -
wpf 研习1-24小时自学wpf9
2010-06-08 19:19 745events handle routed event: ... -
wpf 研习1-24小时自学wpf8
2010-06-07 16:10 853A real-world program basic ... -
wpf 研习1-24小时自学wpf7
2010-06-07 11:04 807Application deployable file ... -
wpf 研习1-24小时自学wpf6
2010-06-05 17:14 836Data Binding markup extensi ... -
wpf 研习1-24小时自学wpf5
2010-06-05 16:14 1033basic Control Control base ... -
wpf 研习1-24小时自学wpf4
2010-06-05 11:31 630Layout Panel,Decorator; Sy ... -
wpf 研习1-24小时自学wpf3
2010-06-04 19:11 787wpf项目文件 vs->新项目->wpf应用程序 ... -
wpf 研习1-24小时自学wpf2
2010-06-04 15:39 800XAML,既然用户控件是一个大类,那么干脆对这个集合进行统一的 ... -
wpf 研习1-24小时自学wpf1
2010-06-04 12:05 690WPF是微软.net的UI 架构,也是非常重要的框架。 ... -
wpf主要知识点
2010-06-04 10:47 943template,presenter,layout,visua ... -
路由事件
2010-05-17 22:09 616如果我们在一个窗口上增加一个按钮,并且看下它的后置代码,会发现 ...
相关推荐
2.3 XAML中的属性和事件 24 2.3.1 简单属性与类型转换器 25 2.3.2 复杂属性 26 2.3.3 标记扩展 28 2.3.4 附加属性 29 2.3.5 嵌套元素 30 2.3.6 特殊字符与空白 32 2.3.7 事件 34 2.3.8 完整的Eight Ball Answer示例 ...
2.3 XAML中的属性和事件 24 2.3.1 简单属性与类型转换器 25 2.3.2 复杂属性 26 2.3.3 标记扩展 28 2.3.4 附加属性 29 2.3.5 嵌套元素 30 2.3.6 特殊字符与空白 32 2.3.7 事件 34 2.3.8 完整的Eight Ball Answer示例 ...
第5章 路由事件 第6章 控件 第7章 application类 第8章 元素绑定 第9章 命令 第10章 资源 第11章 样式和行为 第12章 形状、画刷和变换 第13章 几何图形和图画 第14章 效果和可视比对象 第15章 动画基础 ...
第5章 路由事件 第6章 控件 第7章 application类 第8章 元素绑定 第9章 命令 第10章 资源 第11章 样式和行为 第12章 形状、画刷和变换 第13章 几何图形和图画 第14章 效果和可视比对象 第15章 动画基础 第16章 高级...
第5章 路由事件 第6章 控件 第7章 application类 第8章 元素绑定 第9章 命令 第10章 资源 第11章 样式和行为 第12章 形状、画刷和变换 第13章 几何图形和图画 第14章 效果和可视比对象 第15章 动画基础 第16章 高级...
5.4.3 Command命令事件 5.5 单选控件和单选组控件(RadioButton和RadioButtonList) 5.5.1 单选控件(RadioButton) 5.5.2 单选组控件(RadioButtonList) 5.6 复选框控件和复选组控件(CheckBox和CheckBoxList) ...
5.4.3 Command命令事件 5.5 单选控件和单选组控件(RadioButton和RadioButtonList) 5.5.1 单选控件(RadioButton) 5.5.2 单选组控件(RadioButtonList) 5.6 复选框控件和复选组控件(CheckBox和CheckBoxList) ...
5.4.3 Command命令事件 5.5 单选控件和单选组控件(RadioButton和RadioButtonList) 5.5.1 单选控件(RadioButton) 5.5.2 单选组控件(RadioButtonList) 5.6 复选框控件和复选组控件(CheckBox和CheckBoxList) ...
5.4.3 Command命令事件 5.5 单选控件和单选组控件(RadioButton和RadioButtonList) 5.5.1 单选控件(RadioButton) 5.5.2 单选组控件(RadioButtonList) 5.6 复选框控件和复选组控件(CheckBox和CheckBoxList) ...
5.4.3 Command 命令事件 5.5 单选控件和单选组控件(RadioButton 和RadioButtonList) 5.5.1 单选控件(RadioButton) 5.5.2 单选组控件(RadioButtonList) 5.6 复选框控件和复选组控件(CheckBox 和CheckBoxList)...
5.4.3 Command命令事件 5.5 单选控件和单选组控件(RadioButton和RadioButtonList) 5.5.1 单选控件(RadioButton) 5.5.2 单选组控件(RadioButtonList) 5.6 复选框控件和复选组控件(CheckBox和CheckBoxList) ...