title: Deleting an Image that has been used by a WPF control
body: <p>I would like to bind an Image to some kind of control an delete it later on.</p>
  
  <pre><code>path = @"c:\somePath\somePic.jpg"
  FileInfo fi = new FileInfo(path);
  Uri uri = new Uri(fi.FullName, UriKind.Absolute);
  var img = new System.Windows.Controls.Image();
  img.Source = new BitmapImage(uri);
  </code></pre>
  
  <p>Now after this code I would like to delete the file : </p>
  
  <pre><code>fi.Delete();
  </code></pre>
  
  <p>But I cannot do that since the image is being used now.
  Between code fragment 1 en 2 what can I do to release it?</p>