在wpf中重新加载图像

我正在尝试重新加载我在WPF中显示的图像(System.Windows.Controls.Image)。 我设置源代码如下:

ScreenAtco01Image.Source = new BitmapImage(new Uri(@"Y:/screenshots/naratco08-0-0-screenshot.png", UriKind.RelativeOrAbsolute)); 

我做了一个按钮,它应该强制重新加载这个图像(它每秒在磁盘上更改)。

我已经尝试重置源,但这没有做任何事情。 但是,如果我将Source更改为其他图像,则会加载此不同的图像。 似乎某些事情正在被缓存?

谢谢你的帮助。

找到一个适合我的答案:

 BitmapImage _image = new BitmapImage(); _image.BeginInit(); _image.CacheOption = BitmapCacheOption.None; _image.UriCachePolicy = new RequestCachePolicy(RequestCacheLevel.BypassCache); _image.CacheOption = BitmapCacheOption.OnLoad; _image.CreateOptions = BitmapCreateOptions.IgnoreImageCache; _image.UriSource = new Uri(@"Y:/screenshots/naratco08-0-0-screenshot.png", UriKind.RelativeOrAbsolute); _image.EndInit(); ScreenAtco01Image.Source = _image;