Question

I'm getting quite weird behavior with ClearType whenever I use AeroGlass in my WPF applications. I have found out that the following line sets my font rendering back to grey-scale:

mainWindowSrc.CompositionTarget.BackgroundColor = Colors.Transparent;

To get it back to work with AeroGlass I must set these .NET 4.0 properties to every control containing text:

RenderOptions.ClearTypeHint="Enabled" TextOptions.TextFormattingMode="Display" TextOptions.TextRenderingMode="ClearType"

Then it looks like this:

grey-scale on the left, cleartype on the right

Is there a way to achive the same effect without setting these properties to every control on the window?

Thanks.

Was it helpful?

Solution

You could set this globally in the MainWindows constuctor.

Something like this:

RenderOptions.ClearTypeHintProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata { DefaultValue = ClearTypeHint.Enabled });
TextOptions.TextFormattingModeProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata { DefaultValue = TextFormattingMode.Display });
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top