I'm new to WPF and am having some trouble loading an image from a file that has been modified.
I have an image control called Image1, which I load in the following manner
string fileName = "C:\\Users\\..\\myImage.jpg"
BitmapImage tmp = new BitmapImage();
tmp.BeginInit();
tmp.UriSource = new Uri(@fileName, UriKind.Absolute);
tmp.CacheOption = BitmapCacheOption.OnLoad;
tmp.EndInit();
Image1.Source = tmp;
This works the first time, but then I run a function which overwrites myImage.jpg, at which point I call this code again, expecting Image1 to update. However, the GUI remains unchanged. Does it have something to do with the cacheoption? I need that so that I can overwrite the file.