0

I am working on WPF application (.NET Framework 4). I am adding .png images to ResourceDictionary. It looks like that:

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<BitmapImage x:Key="IconReset" UriSource="../Icons/IconReset.png" />
<BitmapImage x:Key="IconCopy" UriSource="../Icons/IconCopy.png" />
...
</ResourceDictionary>

And then I am using those images:

<Image Width="22" Height="22" Source="{DynamicResource IconReset}" SnapsToDevicePixels="True" />

It is working fine but images in application are a bit blurred and unclear. Png images are of size 22x22 and they look fine and clear.

So why in my application those icons are blurred? I have tried setting property SnapsToDevicePixels but it didn't change anything.

What can I do to make it look like orginal png images - how to get rid of this blur?

Any help much appreciated!

Marta
  • 2,857
  • 13
  • 46
  • 67
  • possible duplicate of [My images are blurry! Why isn't WPF's SnapsToDevicePixels working?](http://stackoverflow.com/questions/592017/my-images-are-blurry-why-isnt-wpfs-snapstodevicepixels-working) – Tim May 23 '12 at 17:00
  • you are right - it may be duplicate. UseLayoutRounding="True" worked in my application. – Marta May 23 '12 at 17:06

1 Answers1

0

Try to set property:

UseLayoutRounding="True" 

It is best to set it on main window/root element, then it will affect whole application.

Marta
  • 2,857
  • 13
  • 46
  • 67