title: Is it possible to change an ImageBrush color inside WPF?
body: <p>I'm trying to do something quite simple, but I'm not sure if it's possible. I have this image:</p>
  
  <p><img src="https://i.stack.imgur.com/bfHPC.png" alt="Tile target"></p>
  
  <p>Inside my board game project, I use this to indicate the mouse position in the board and stuff like that (being the board a 8x8 grid with a rectangle inside). I'm also setting the grid cell background brush as, say, a SolidColorBrush with Blue color and .25 opacity, while the rectangle that lies above it with the target, or vice-versa, because I couldn't achieve my desired effect, which is, the part that is black to turn full blue, as my brush, while the rest remains with the opacity and etc. The way I did, it was possible to make the black part become blueish, with a transluscent background, but the color in the border isn't quite right yet:</p>
  
  <p><img src="https://i.stack.imgur.com/etrpz.jpg" alt="enter image description here"></p>
  
  <p>I don't know if I was able to make myself clear, but I guess the picture shows what is my goal.</p>
  
  <p>The code:</p>
  
  <pre><code>            ImageBrush targetBrush = new ImageBrush();
              targetBrush.ImageSource = new BitmapImage(new Uri("Resources/GameScreen/selectedTile.png", UriKind.Relative));
              targetBrush.Opacity = 1;
  
              SolidColorBrush backBrush = new SolidColorBrush(Colors.Blue);
              backBrush.Opacity = .25;
  
              tile.Children.Add(new Rectangle());
              foreach (object target in tile.Children)
              {
                  if (target.GetType() == typeof(Rectangle))
                  {
  
                      ((Rectangle)target).Fill = backBrush;
                  }
              }
  
  
  
              tile.Background = targetBrush;
  </code></pre>
  
  <p>Thanks in advance.</p>