WPF 处理路由事件

(1)img.MouseUp+= img_MouseUp;
(2)调用 UIElement.AddHandler()直接连接事件;
img.AddHandler(Image.MouseUpEvent, new MouseButtonEventHandler(img_MouseUp));
(3)使用定义事件的类的名称,而不是引发事件的类的名称;
img.AddHandler(UIElement.MouseUpEvent, new MouseButtonEventHandler(img_MouseUp));
缺点:不能很明确地指明事件是由Image类提供的

posted @ 2014-01-23 19:55  quietwalk  阅读(257)  评论(0编辑  收藏  举报