There is a protected property of
Image
called
BaseUri
so you could do a little hack and create a new class that inherits the
Image
class and has got a function returning
base.BaseUri.AbsolutePath
. Then call this function to check wether the image refers to the path or not.
However, I think there could be a better solution I don't know yet.
[Edit]
Now I've got one:)
I'm using the
Image.Source
property that refers to a URI so I have to declare the string to check equality as follows:
string uri = "C:/Users/New1/Desktop/ba/WpfApplication1/WpfApplication1/img/gol1s2.gif";
This is necessary because after instantiating the
Image
object (you can still use an absolute or relative path on your hard-disk-drive for instantiating) the reference to the Image-File is saved as URI.
Finally check if the correct image has been loaded:
if (image1.Source.ToString().Contains(uri))
{
}