title: How to set my downloaded image to my listbox UI object?
body: <p>I'm working in a Windows Phone 7 application that download several images at run time (meaning they are not added on my executable as resources).</p>
  
  <p>For downloading the images I use the approach described on the next link: 
  <a href="https://stackoverflow.com/questions/6940880/set-image-source-to-a-uri">Set image source to an uri</a>
  and it seems to be working fine.</p>
  
  <p>I'm having a hard time trying to set my downloaded images to my list box which contains a custom control.</p>
  
  <p>In my xaml page my lisbox looks like this:</p>
  
  <pre><code>  &lt;ListBox x:Name="listBox_1" Margin="0,0,-12,0" ItemsSource="{Binding Items}"&gt;
             &lt;ListBox.ItemTemplate&gt;
                      &lt;DataTemplate&gt;
                           &lt;mylocal:customcontrol_A id="{Binding PId}" /&gt;
                      &lt;/DataTemplate&gt;
              &lt;/ListBox.ItemTemplate&gt;
              &lt;ListBox.ItemsPanel&gt;
                      &lt;ItemsPanelTemplate&gt;
                            &lt;toolkit:WrapPanel  Orientation="Horizontal"  /&gt;
                      &lt;/ItemsPanelTemplate&gt;
              &lt;/ListBox.ItemsPanel&gt;
    &lt;/ListBox&gt;    
  </code></pre>
  
  <p>My custom control contains an Image and several TextBlock's as follow:</p>
  
  <pre><code>&lt;Grid x:Name="LayoutRoot" Height="180" Width="470" Margin="0,10,0,0"&gt;
      &lt;Grid.ColumnDefinitions&gt;
          &lt;ColumnDefinition Width="452*" /&gt;
          &lt;ColumnDefinition Width="18*" /&gt;
      &lt;/Grid.ColumnDefinitions&gt;
      &lt;Image Name="img_1" Source="{Binding PImage1, Converter={StaticResource requestConverter}}" /&gt;
      &lt;TextBlock Name="txtB_0" Text="{Binding PName0}" Foreground="Black" /&gt;
      &lt;TextBlock Name="txtB_1" Text="{Binding PName1}"  Foreground="Black" /&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p>Im using the Converter to launch the webclient that will download the image.</p>
  
  <p>Once my asynchronous request has completed, and I have my image stored in my IsolatedStorageFile area, I can build a BitMapImage on the callback of my MainPage, but I haven't found how to iterate through my listBox_1 in order to access my custom command Image to set the Source property as in the above link suggested. </p>
  
  <p>I would like to do something equivalent to the next</p>
  
  <pre><code> BitmapImage image = new BitmapImage();
   image.SetSource(stream);
  
   foreach (customcontrol_A bc in listBox_1.Items)
   {
        if (bc.id == id)
        {
              bc.img_1.Source = image;
              founded = true;
              break;
        }
   }
  </code></pre>
  
  <p>But the problem is that listBox_1.Items are instances of myBindingClassA, not of the actual GUI elements customcontrol_A. </p>
  
  <p>I would really appreciate any suggestion on how can I get a reference to the Image GUI object so I can simply set the Source with a BitmapImage.</p>
  
  <p>Thanks a lot in advance!</p>