Cody
Cody

Reputation: 8964

Why is some of the text in my WPF 4.5 application still blurry?

I don't understand. I am going crazy - no matter what I do, the text in my WPF application is blurry. Well, some of it - one of the text elements is focused, and so are the close/minimize buttons. I have applied the TextOptions.TextRenderingMode="ClearType" and TextOptions.TextFormattingMode="Display" to the elements directly, and I have also tried applying it to the MainWindow.xaml, which is created by default using the ModernUI for WPF framework.

I'm going nuts - all the literature I find says this was fixed, but I'm still dealing with the issue. (I've changed the font to Calibri/Consolas and also played with the size and weight - still blurry.)

How can I fix this?

Edit: If I use the monitor I have at work (resolution 1920x1200) with standard DPI settings, I'm not so sure I have the issue. On the laptop display I am using I have a very high resolution (2880x1620) with the text scaling set to larger. On this display is where I'm currently seeing the text as "not crisp". I should also note that in the designer, the text appears fine. It is when the application runs that the text looks terrible.

An example of the blurry text.

Upvotes: 0

Views: 1422

Answers (3)

Cody
Cody

Reputation: 8964

So, I found out my issue is specifically with the Modern UI Framework. I'm not sure why. I switched over to using MahApps.Metro and I have no issues with font clarity.

Upvotes: 1

Ayyappan Subramanian
Ayyappan Subramanian

Reputation: 5366

It is by Design. Those different set of controls and they have different styles of font color. For Example Settings and Help in the Top right of the window they are using the style SystemButtonLink which is defined below

<Style x:Key="SystemButtonLink" TargetType="ButtonBase" BasedOn="{StaticResource SystemButtonBase}" >
    <Setter Property="Foreground" Value="{DynamicResource LinkButtonText}"/>
    <Setter Property="Width" Value="NaN" />
    <Setter Property="Height" Value="NaN" />
    <Setter Property="FontFamily" Value="Segoe UI" />
    <Setter Property="FontSize" Value="11" />
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type ButtonBase}">
                <Border Name="Chrome"
                            Background="{TemplateBinding Background}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            SnapsToDevicePixels="true">
                    <TextBlock DataContext="{TemplateBinding Content}"
                               Text="{Binding Converter={StaticResource ToUpperConverter}}"
                               Margin="{TemplateBinding Padding}"
                               VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                               HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                               SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                </Border>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
    <Style.Triggers>
        <Trigger Property="IsMouseOver" Value="True">
            <Setter Property="Foreground" Value="{DynamicResource LinkButtonTextHover}"/>
        </Trigger>
        <Trigger Property="IsPressed" Value="True">
            <Setter Property="Foreground" Value="{DynamicResource LinkButtonTextPressed}" />
        </Trigger>
        <Trigger Property="IsEnabled" Value="false">
            <Setter Property="Foreground" Value="{DynamicResource LinkButtonTextDisabled}" />
        </Trigger>
    </Style.Triggers>
</Style>

If you refer the three colors used in the style for Mouse hover, Pressed and IsEnabled. More code can be refered in the site. https://mui.codeplex.com/SourceControl/latest

Upvotes: 0

Muds
Muds

Reputation: 4116

to start with you can try with

<TextBlock Text="Am I Still Blurry." RenderOptions.ClearTypeHint="Enabled"/>

you might wanna have a look at this post for clearer understanding

Upvotes: 0

Related Questions