title: Set and Change Button Image by Cliciking on it WPF, C#
body: <p><br/>
  I've got a class, which holds 8 BitmapImage in an array. <br/>The Images are added in the following way in the class constructor: <br/></p>
  
  <pre><code>  public SymbolCollection(string[] symbolNames)
          {
              Symbols = new BitmapImage[8];
  
              for (int i = 0; i &lt; Symbols.Length; i++)
              {
                  Symbols[i] = new BitmapImage();
                  Symbols[i].BeginInit();
                  Symbols[i].UriSource = new Uri(@"/Resources/" + symbolNames[i] + ".png", UriKind.Relative);
                  Symbols[i].EndInit();
              }
  
          }
  </code></pre>
  
  <p><br/>
  The button's ImageSource are set to the following: </p>
  
  <pre><code> &lt;Button x:Name="buttonPlayer1" HorizontalAlignment="Left" Height="80" Margin="44,387,0,0" VerticalAlignment="Top" Width="80" Click="OnPlayerSymbolClick"&gt;
              &lt;Button.Template&gt;
                  &lt;ControlTemplate&gt;
                      &lt;Image Source="{Binding Content}"/&gt;
               &lt;/ControlTemplate&gt;
              &lt;/Button.Template&gt;
          &lt;/Button&gt;
  </code></pre>
  
  <p>I tried to set the image to the button in the MainWindow() method and change it in the OnPlayerSymbolClick() method, but the image doesn't even show up: </p>
  
  <pre><code>public MainWindow()
  {   
      this.InitializeComponent();
      SetSymbolCollection();
  
      Uri u = symbolCollectionHolder[0].Symbols[0].UriSource;
      Debug.WriteLine(u.ToString());
      Image i = new Image();
      BitmapImage bmp = new BitmapImage();
      bmp.UriSource = u;
      i.Source = bmp;
      buttonPlayer1.Content = i;
  }
  
  
  private void OnPlayerSymbolClick(object sender, RoutedEventArgs e)
  {
      ImageBrush imagebrush = new ImageBrush();
      imagebrush.ImageSource = symbolCollectionHolder[0].Symbols[1];
      buttonPlayer1.Background = imagebrush;
      buttonPlayer1.Content = imagebrush;
      Debug.WriteLine(buttonPlayer1.Background.ToString());
      Debug.WriteLine(imagebrush.ImageSource.ToString());
  }
  </code></pre>
  
  <p>The Build Action for the png-s are set to Resource and there's a Resources folder in the project. </p>