Lester's WPF\SL Blog

Simple, Easy & Beautiful

New WPF Features: LayoutRounding

New WPF Features: LayoutRounding

Rate This
  • Comments 3

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

 

  • What's SL and how do you and where do you set the LayoutRounding.

  • What's SL and how do you and where do you set the LayoutRounding.

  • SL--> Silverlight.. layout rounding comes by default

Page 1 of 1 (3 items)