wpfclarity

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


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>

Solution

  • Play around with the following parameters for your Window:

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