title: binding image control to listbox selected item
body: <p>I have a listbox,inside that item template,and inside that data template(as usual). My aim
  is- in listbox selection changed event, I want to bind listbox selected item to a image control-and my code is--</p>
  
  <pre><code>ListBox lb = (ListBox)sender;
  
  ListBoxItem item = (ListBoxItem)lb.SelectedItem;
  
  Image im = (Image)item.Content;
  Image1.Source = new BitmapImage(((BitmapImage)im.Source).UriSource);
  </code></pre>
  
  <p>and my <code>ListBox.ItemTemplate</code> looks like this:</p>
  
  <pre><code>&lt;ListBox Name="imageList" Height="556" Width="130" HorizontalAlignment="Left" Style="{StaticResource ListBoxStyle1}" SelectionChanged="imageList_SelectionChanged" &gt;
     &lt;ListBox.ItemTemplate&gt;
        &lt;DataTemplate&gt;
           &lt;Image Source="{Binding Imgs}" Width="100" Height="100"/&gt;
        &lt;/DataTemplate&gt;
     &lt;/ListBox.ItemTemplate&gt;
  &lt;/ListBox&gt;
  </code></pre>
  
  <p>But it is showing exception. <code>Image1</code> is my image control and I don't want to bind image source in xaml. I have some certain requirements.</p>