Sunday, August 26, 2012

Silverlight Path is blurry - How to snap to pixels?

Silverlight Path is blurry - How to snap to pixels?

I have a Canvas onto which I draw a Path:

<Path Data="M 380 110 v -10 l 100 -100"       Stroke="#C0C0C2" StrokeThickness="1" UseLayoutRounding="True" /> 

Even though the StrokeThickness is set to 1, the vertical part of the path is drawn across 2 pixels and in a lighter color.

Silverlight Path

I know that WPF has the SnapsToDevicePixels property that would fix it, and I read that in Silverlight there is a UseLayoutRounding property that you can use in some cases to have the same effect, however it does not seem to apply to Path.

Is there anything I can do to get that line drawn properly?

Answers & Comments...

Answer: 1

There is a pixel snapper class over at MSDN on Dave Relyea's Silverlight Blog. That is what I have used in the past for Silverlight pixel snapping.

by : Chris Granthttp://stackoverflow.com/users/525448




No comments:

Post a Comment

Send us your comment related to the topic mentioned on the blog