Developing for Modern Windows

Tips, tricks, and guides for developing on modern Windows platforms

BitmapIcon – Use an Image Like an Icon

In Universal Windows Platform Apps you can use BitmapIcon to treat an image as if it’s an icon/text. In my current project I use this feature to colour some white images with transparent backgrounds to match my app’s changeable theme colour.

Here’s a simple example of it in use:

<Button x:Name="MyButton" Foreground="{StaticResource MainColourBrush}" Background="{x:Null}" Tapped="MyButton_Tapped">
<BitmapIcon UriSource="Images/UI/image.png" Foreground="{StaticResource MainColourBrush}" />

That white image will be coloured to match MainColourBrush, just as you can change the colour of text.


Leave a Reply

Your email address will not be published.