title: How to change\set background image of a button in C# WPF code?
body: <p>I'm trying to change background image of my button to some other image and I encountered some errors.
  This is the code I have on my xaml: </p>
  
  <pre><code>    &lt;Button x:Name="Button1" Width="200" Height="200" Content="Button1" Margin="0,0,0,400"&gt;
          &lt;Button.Background&gt;
              &lt;ImageBrush **ImageSource ="Images/AERO.png"**  &gt;&lt;/ImageBrush&gt;
          &lt;/Button.Background&gt;
      &lt;/Button&gt;
  </code></pre>
  
  <p>and my cs:</p>
  
  <pre><code>    private void Button1_Click_1(object sender, RoutedEventArgs e)
      {
          var brush = new ImageBrush();
          brush.ImageSource = new BitmapImage(new Uri("Images/AERO.png"));
          Button1.Background = brush;
      }
  </code></pre>
  
  <p>The error I have on my xaml is " The file 'Images\logo.png' is not part of the project or its 'Build Action' property is not set to 'Resource'. 
  Can anyone help me explain, thanks</p>