How to get rid of the blurry fonts for menus when using WPF?

721 views Asked by At

WPF beginner here. I'm trying to mimic the font style used in Visual Studio 2010 for menus. Under Windows XP menus look blurry.

screenshot

How can my code be changed to get the same result?

<Window x:Class="Test_WPF.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="480" Width="640">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Menu IsMainMenu="True">
            <MenuItem Header="_File" />
            <MenuItem Header="_Edit" />
            <MenuItem Header="_View" />
            <MenuItem Header="_Window" />
            <MenuItem Header="_Help" />
        </Menu>
    </Grid>
</Window>
2

There are 2 answers

1
thumbmunkeys On BEST ANSWER

Play around with the following parameters for your Window:

    <Window x:Class="Test_WPF.MainWindow"
           ....
    UseLayoutRounding="True"
    TextOptions.TextFormattingMode="Display"
    TextOptions.TextRenderingMode="ClearType">
0
Matteo Gariglio On

In my case, the blurring was caused by a DropShadowEffect applied on a wrapped Grid. Removing this effect makes the blur issue disappear.