标签:blog ar 2014 代码 log new ad type
自定义路由事件大体上可分为三个步骤:public class TimeButton : Button { /// <summary> /// 声明并注册路由事件。 /// </summary> public static readonly RoutedEvent ReportTimeEvent = EventManager.RegisterRoutedEvent("ReportTime", RoutingStrategy.Bubble, typeof(EventHandler<ReportTimeEventArgs>), typeof(TimeButton)); /// <summary> /// CLR事件包装器。 /// </summary> public event RoutedEventHandler ReportTime { add { this.AddHandler(ReportTimeEvent, value); } remove { this.RemoveHandler(ReportTimeEvent, value); } } /// <summary> /// 激发路由事件,借用Click事件的激发方法。 /// </summary> protected override void OnClick() { base.OnClick(); ReportTimeEventArgs args = new ReportTimeEventArgs(ReportTimeEvent, this); args.ClickTime = DateTime.Now; this.RaiseEvent(args); } }
标签:blog ar 2014 代码 log new ad type
原文地址:http://blog.csdn.net/gjysk/article/details/38611071