wpf中 如何对图片添加单击鼠标左键事件呢
在窗体上加入了如下内容:
<local:ImageLoader Source="{Binding ThumbnailPic}" HorizontalAlignment="Left" Cursor="Hand" Tag="{Binding}" MouseLeftButtonDown="HanleOpenImageViewerForStatus"/>
后端代码如下
private void HanleOpenImageViewerForStatus(object sender, RoutedEventArgs e)
{
var target = sender as FrameworkElement;
var data = target.Tag as StatusData;
viewPhotos.ShowImage(data, true);
}
编译通过,然后打开问题创体会提示的错误信息:
无法从文本“HanleOpenImageViewerForStatus”创建“MouseLeftButtonDown”。
------解决方案--------------------不是这个参数吧???同学RoutedEventArgs