0

here I have an image (I want to display it as an icon in my list). and I have to change its color when it's selected.

I tried this solution before: https://stackoverflow.com/a/42794551/14564778

With this codes:

<Grid Margin="5,0,0,0">
   <Image Height="25" Width="25" Source="{Binding ItemImageSource}" RenderOptions.BitmapScalingMode="Fant"/>
        <Rectangle Height="25" Width="25" Fill="{StaticResource orangePink}" RenderOptions.BitmapScalingMode="Fant">
                  <Rectangle.OpacityMask>
                       <ImageBrush ImageSource="{Binding ItemImageSource}"/>
                  </Rectangle.OpacityMask>
       </Rectangle>
 </Grid>

The problem I got is the shape of the image is not consistent when I apply the new color

Image1

Note that the images that I use are high resolution images.

so, If anyone can help me with codes or third-party library or another way. I will be happy for this.

thx...

a7d.24_
  • 170
  • 1
  • 12
  • You should be using vector icons (e.g. a Path element with a PathGeometry) which would simply be filled with a Brush. – Clemens Aug 14 '22 at 13:09
  • You can use inkscape to automate tracing of bitmaps into vectors. – Andy Aug 14 '22 at 13:36

0 Answers0