Assume I have an Image object which his Source property being initialized in the following way:
BitmapImage source = new BitmapImage();
source.BeginInit();
source.CacheOption = BitmapCacheOption.OnLoad;
source.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
source.UriSource = new Uri("C:\\Temp\\tech\\window.jpg");
source.EndInit();
image.Source = source; // image object automatically initialized in the window construction.
As you can implicitly see, window.jpg is an image that permanently changed (get deleted and replaced with a new different image with the same name).
I have been using the above mentioned way to initialize the Image object Source property because I have found it at Image does not refresh in custom picture box as a way to support the Image refreshing.
However, when deleting and replacing window.jpg while the program is running, the Image object still shows the image that was loaded when we initialized its Source property (cache).
It seems like the Image object ignores the BitmapCreateOptions.IgnoreImageCache value and doesn't refresh the image when a new one replacing the previous that was deleted.
Any solution will be welcomed.
EDIT
I don't want to change the filename because I would need to redundantly find a random name that doesn't exist instead of just refreshing the image to load the same Source again.
I don't want to change the Source property value because of the fact that I don't change the filename.
The desired solution is to update the  Image object each time the image file changes. The image change controlled by me so there is no need to bind and wait for a change, instead, I would force an image refresh, if it possible.
 
     
    