Ever since the introduction of WPF, applications developed using the technology have all had a similar look - fuzzy. In .NET 4, the developers at Microsoft made great strides in the clarity and readability of WPF applications. Up until .NET 4, developers have used many tricks to get icons and line edges clearer than they are by default. Whereas some tricks may still be needed, one new property puts an end to much of the fuzziness frustration - UseLayoutRounding. Below is an example of how UseLayoutRounding can help us. The left image is how WPF acts by default. The right is with UseLayoutRounding set to true.
The above examples are made using a very basic WPF application. The only difference between the applications is whether or not UseLayoutRounding is enabled.<Window x:Class="UseLayoutRoundingTutorial.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow"
Height="350"
Width="525"
UseLayoutRounding="True">
<Grid>
<Image Source="image.png" Width="100" Height="100" />
</Grid>
</Window>Read more: Switch on code
QR:
The above examples are made using a very basic WPF application. The only difference between the applications is whether or not UseLayoutRounding is enabled.<Window x:Class="UseLayoutRoundingTutorial.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow"
Height="350"
Width="525"
UseLayoutRounding="True">
<Grid>
<Image Source="image.png" Width="100" Height="100" />
</Grid>
</Window>Read more: Switch on code
QR: