(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类提供的

相关文章:

  • 2022-12-23
  • 2021-09-08
  • 2019-12-01
  • 2021-05-17
  • 2021-09-19
猜你喜欢
  • 2021-06-19
  • 2021-08-29
  • 2021-06-30
  • 2022-12-23
相关资源
相似解决方案