0

I'm having an issue with an image (native 32x32px) in my WPF window displaying oddly.

It is defined in a grid like so:

<Grid>
     <Grid.ColumnDefinitions>
           <ColumnDefinition Width="36"/>
           <ColumnDefinition/>
     </Grid.ColumnDefinitions>
     <Image Margin="2" Source="/KCP Doc Manager;component/Media/Icons/if__Tick_1904674 (1).png" Height="32" Width="32"/>
     <TextBlock Grid.Column="1" Margin="5,0,0,0" Text="Recently approved items:" Style="{StaticResource Heading}"/>
</Grid>

When the window loads my image looks like this: enter image description here

Resizing the window by 1px fixes the rendering issue like so:

enter image description here

The behavior cycles for each pixel the window is resized.

Any idea on how I can keep the image sharp?

Loocid
  • 6,112
  • 1
  • 24
  • 42

1 Answers1

0

Try setting Stretch="None". If that doesn't work then try Stretch="UniformToFill", and possibly even SnapsToDevicePixels="True".

Mark Feldman
  • 15,731
  • 3
  • 31
  • 58
  • Alas none of those work. `Stretch="None"` blew the image up for some reason, the others had no effect. Ive kind of solved the problem now by using a 48x48px image and downscaling it. Not ideal but it makes the effect barely noticeable (but still there). – Loocid Jul 09 '18 at 07:35