title: Binding Image's Source in XAML DataTemplate to a URI in Silverlight 4
body: <p>Okay, what I'm trying to create is a list of images (using a listbox) with a thumbnail on the left, and image title on the right. My XAML is set up this way:</p>
  
  <pre><code>&lt;ListBox HorizontalAlignment="Left" Margin="6,6,0,6" Name="CurrentPhotos" Width="184" SelectionChanged="CurrentPhotos_SelectionChanged"&gt;
      &lt;ListBox.ItemTemplate&gt;
          &lt;DataTemplate&gt;
              &lt;StackPanel Orientation="Horizontal"&gt;
                  &lt;Image Source="{Binding Converter={StaticResource FilePathConverter}}" /&gt;
                  &lt;sdk:Label Content="{Binding Title}"&gt;&lt;/sdk:Label&gt;
              &lt;/StackPanel&gt;
          &lt;/DataTemplate&gt;
      &lt;/ListBox.ItemTemplate&gt;
  &lt;/ListBox&gt;
  </code></pre>
  
  <p>I've got the FilePathConverter key defined in App.xaml and the code is set up:</p>
  
  <pre><code>public class FilePathConverter : IValueConverter
  {
  
      public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
      {
          if (targetType == typeof(string))
          {
              return (value as PhotoSummary).FullThumbPath();
          }
          else
          {
              return (value as PhotoSummary).Thumb();
          }
  
      }
  
      public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
      {
          throw new NotImplementedException();
      }
  }
  </code></pre>
  
  <p>There are breakpoints in both Convert and ConvertBack methods. ConvertBack never gets fired (so there's no exception etc.), and in Convert method, the Thumb returns correctly (string input is left for some test reasons, and not currently used. it's not fired anyways), and the Thumb extension method is this:</p>
  
  <pre><code>public static object Thumb(this PhotoSummary ps)
  {
      Uri uri = new Uri("http://" + Settings.Host + "/Content/Thumbs/" + ps.Uploaded.Year + "/" + ps.Uploaded.Month + "/" + ps.ID + ".jpg", UriKind.Absolute);
      return new BitmapImage(uri);
  }
  </code></pre>
  
  <p>This one gets called, and the Uri is built up correctly (tested several times). However, when I run the app, the list only contains the Title of the photo, and no image is there. All the images are small (they are just thumbs), local files, so they need to load up instantly so it's not a loading issue either. But it's as if there's no Image tag there. It just displays the labels of the photos. Converter is working, Uri is correct, there are no errors at all, but no image shows up.</p>
  
  <p>Any suggestions?</p>