title: Pass image in a new window in WPF/C#
body: <p>I've got some images in a ListBox. When the user clicks one image, I'd like to open a new window (ImageWindow) and show the clicked image in the new window. I've added already a new XAML-file and a eventhandler. This is what I got:</p>
  
  <p>MainWindow:</p>
  
  <pre><code>&lt;ListBox Name="MainListBox"&gt;
      &lt;ListBox.ItemTemplate&gt;
          &lt;DataTemplate&gt;
              &lt;DockPanel HorizontalAlignment="Center"&gt;
                  &lt;Image Source="{Binding}" MouseDown="Image_MouseDown"&gt;&lt;/Image&gt;
              &lt;/DockPanel&gt;
          &lt;/DataTemplate&gt;
      &lt;/ListBox.ItemTemplate&gt;
  &lt;/ListBox&gt;
  
  /*========================================================================*/
  
  private void Image_MouseDown(object sender, MouseButtonEventArgs e)
  {
      ImageWindow imageWindow = new ImageWindow();
      //Pass image
      imageWindow.Show();
  }
  </code></pre>
  
  <p>ImageWindow:</p>
  
  <pre><code>&lt;ListBox Name="ImageListBox"&gt;
      &lt;ListBox.ItemTemplate&gt;
          &lt;DataTemplate&gt;
              &lt;DockPanel HorizontalAlignment="Center"&gt;
                  &lt;Image Source="{Binding}"&gt;&lt;/Image&gt;
              &lt;/DockPanel&gt;
          &lt;/DataTemplate&gt;
       &lt;/ListBox.ItemTemplate&gt;
  &lt;/ListBox&gt;
  </code></pre>
  
  <p>How do I pass the clicked image?</p>
  
  <p>See <a href="https://www.digitec.ch/de/s1/product/hp-officejet-pro-8620-wlan-duplexdruck-tintenstrahl-schwarz-multifunktionsgeraet-2583566" rel="nofollow">example</a> (click on the image)</p>