Change Image Colour – Transparent Background and Black/White Foreground

Posted: November 9, 2011 in Windows Phone 7 & Mango

If you have an image with a transparent background and a black/white foregound, you can change the colour of the image by trying the following:

<Rectangle Fill="YourColour" Width="48" Height="48">
  <Rectangle.OpacityMask>
    <ImageBrush ImageSource="/Images/YourImage.png"/>
  </Rectangle.OpacityMask>
</Rectangle>
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s