Is there a way to emulate UseLayoutRounding in WPF with .Net 3.5
For installation reasons, I'd like to use 3.5 in my application. The only feature that I would be lacking is UseLayoutRounding, which worked very nicely with 开发者_开发百科my custom controls. Is there a way to emulate UseLayoutRounding in 3.5?
Depending on your exact requirements, SnapsToDevicePixels="true"
may be sufficient.
In case someone still need a workaround, here's the link, look for the Thomas Levesque comment: http://tech.pro/tutorial/1062/wpfs-most-important-property-uselayoutrounding
We had a similar issue at work in a WPF 3.5 project, and eventually we solved it by setting RenderOptions.BitmapScalingMode to NearestNeighbor and displaying the images in their original size (Stretch=None)
<Image Source="/namespace;component/Resources/image.png" Stretch="None" RenderOptions.BitmapScalingMode="NearestNeighbor"/>
This would not solve problems with DPI on different systems though.
精彩评论