title: Load image from file server using Caliburn Micro and Silverlight
body: <p>I have a feeling this is a simple question but I am having a hard time figuring it out.  I'm using Silverlight, MVVM, and Caliburn Micro to develop my project.  In one section, I have an employee lookup that should display the picture of the employee.  The user will put in an ID number and the system should look up the user and find the employee's image on the file server.  The image is named with the employee ID number (for example, 1234.jpg for employee 1234).</p>
  
  <p>I am not loading these pictures as resources at design time since there are hundreds and the user will probably only need one image.  My question is how to I set up my model in order to properly bind to the Image control?  I know to use basic Caliburn Micro (I'm still fairly new to it so I haven't covered all of the less-frequent areas) so I basically would benefit just from the snippets on each area (View, Model View, and Model) that would pertain to the Image control.  The ideal scenario would be to assign the file path of the image to a variable and have it show up on my view as an image.  Then, if the file path is empty, have the image go away.</p>
  
  <p>Here is the code I tried:</p>
  
  <p><strong>View Model</strong> - This is for simplicity.  I'll push some of this to the Model, but the point stands.</p>
  
  <pre><code>public ImageSource Photo
  {
      get
      {
          return new BitmapImage(new Uri(UserPhoto, UriKind.Absolute));
      }
  }
  
  public string UserPhoto
  {
      get
      {
          return this._userPhoto;
      }
      set
      {
          this._userPhoto = value;
          NotifyOfPropertyChange(() =&gt; UserPhoto);
          NotifyOfPropertyChange(() =&gt; Photo);
      }
  }
  </code></pre>
  
  <p><strong>View</strong></p>
  
  <pre><code>&lt;Image x:Name="Photo" /&gt;
  </code></pre>
  
  <p>The UserPhoto property is a string property that holds the URL to the image.  I tried web URLs as well as UNC paths.  The images are verified to be at that location but they don't show up when I fire the INCP on the Photo property.</p>
  
  <p><strong>Update</strong></p>
  
  <p>After more playing around with it, it seems that this solution will work if you use the file path (file://yourserver/yourpath/yourfile.jpg).  I had been attempting to access the public side of the files through http (http://yourserver.domain/yourpath/yourfile.jpg).  The http method does not work but the file method does.  I would still like to use the http method but I at least have a work-around.  Any thoughts as to why file would work but http wouldn't?</p>