我的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事件.
有人能说清楚我做错了吗?