title: Add image on key pressed
body: <p>I am trying to add image to canvas when I press keyboard button:</p>
  
  <pre><code>public MainWindow()
  {
    InitializeComponent();
  }
  
  public void OnKeyDownHandler(object sender, KeyEventArgs e)
  {
      Image img = new Image();
          img.Source = new BitmapImage(new Uri("C:\\Users\\Public\\Pictures\\Sample Pictures\\Koala.jpg"));
  
          Canvas.SetTop(img, 0);
          Canvas.SetLeft(img, 0);
          this.Content = img;
  }
  </code></pre>
  
  <p>Here is the XAML:</p>
  
  <pre><code>&lt;Canvas KeyDown="OnKeyDownHandler" HorizontalAlignment="Left" Height="166" Margin="118,89,0,0" VerticalAlignment="Top" Width="300"/&gt;
  </code></pre>
  
  <p>But when I press a key nothing happens. If I put the same code in MainWindow method, it loads the picture. Where am I wrong?</p>