New WPF Features: LayoutRounding

This is part of a series on New WPF Features

LayoutRounding - If you are familiar with Silverlight, this is nothing new. If you are unfamiliar with it, all it does is that it rounds up lengths..

Take for example the code below (hypothetical case) 

<

Border Width="33.9111111" Height="80.11111" BorderBrush="Red" Margin="2.1222222" BorderThickness="3.955">
<Border Width="15.3333333" Height="40.11111" BorderBrush="Black" Margin="2.3333333" BorderThickness="3.89898555"></Border>

The one on the left is a bit blurry due to the subpixel positioning and doesnt use LayoutRounding. The one on the left is rendered with LayoutRounding and has crisper lines.

The property to enable LayoutRounding is UseLayoutRounding="true" ... By default this is set to false (unlike SL)

You can also take a look at the MSDN documentation

Share this post