小编Jos*_*ese的帖子

为什么在WPF中我的Image Control没有SourceUpdated事件触发器?

我的WPF项目中的窗口上有一个图像控件

XAML:

<Image 
  Source="{Binding NotifyOnSourceUpdated=True, NotifyOnTargetUpdated=True}" 
  Binding.SourceUpdated="bgMovie_SourceUpdated" 
  Binding.TargetUpdated="bgMovie_TargetUpdated" />
Run Code Online (Sandbox Code Playgroud)

在代码中,我正在改变图像的来源

C#:

myImage = new BitmapImage();
myImage.BeginInit();
myImage.UriSource = new Uri(path);
myImage.EndInit();
this.bgMovie.Source = myImage;
Run Code Online (Sandbox Code Playgroud)

但是从不触发bgMovie_SourceUpdated事件.

有人能说清楚我做错了吗?

c# wpf .net-3.5

4
推荐指数
2
解决办法
1万
查看次数

标签 统计

.net-3.5 ×1

c# ×1

wpf ×1