.NET: WPF 路由事件
2015-08-14 16:34
453 查看
(一)使用WPF内置路由事件
xaml:
View Code
xaml:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using System.Data; using MySql.Data; using MySql.Data.Entity; using MySql.Data.MySqlClient; using System.Xml; using System.Xml.Linq; using System.IO; namespace WpfApplication1 { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); //this.gridRoot.AddHandler(Button.ClickEvent, new RoutedEventHandler(this.ButtonClicked)); } private void ReportTimeHander(object sender, ReportTimeEventArgs e) { FrameworkElement element = sender as FrameworkElement; string timeStr = e.ClickTime.ToLongTimeString(); string content = string.Format("{0} 到达 {1}", timeStr, element.Name); this.listBox.Items.Add(content); } } }
View Code
相关文章推荐
- hdu 4841 圆桌问题(STL vector)
- 近期一些想法
- 原生js螺旋运动
- Struts2+Kindeditor整合图片上传
- 逃生 HDU杭电4857 【反向拓扑+优先队列+反向输出】
- Java泛型
- FLUME日志收集系统搭建
- CSU 1204 Rectangles (二分)
- 云端iclound使用-陈棚
- 'System.Web.Http.GlobalConfiguration' does not contain a definition for 'Configure'
- hadoop SequenceFile介绍 大数据 存储
- [Leetcode]String to Integer (atoi)
- ternary searching tree三叉搜索树
- 斐波那契序列 集锦 矩阵乘法
- C++ 运算符重载(1)
- 如何实现一个malloc
- 使用Memory Analyzer Tool(MAT)Eclipse插件分析内存泄露
- SQLiteOpenHelper数据库的创建or升级or增删改查
- Win10技巧:勾掉这几个选项更优体验win10
- CheungSSH国产自动化运维工具开源Web界面