Why does ClearType partially fail with a transparent window?
I have a transparent Window
one that works fine but TextBox
ignores ClearType
.
Installed RenderOptions.ClearTypeHint="Enabled"
but nothing happens. No other effects, OpacityMask, VisualBrush, DrawingBrush, Clip or Opacity only AllowsTransparency="True"
and AllowsTransparency="True"
.
AllowsTransparency = "True"
AllowsTransparency = "False" in normal window
Xaml example
<Window x:Class="WpfApplication3.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Height="200"
Width="300"
Title="MainWindow"
AllowsTransparency="True"
WindowStyle="None">
<Window.Template>
<ControlTemplate>
<Grid Background="White"
Height="200"
Width="300"
RenderOptions.ClearTypeHint="Enabled"
TextOptions.TextRenderingMode="ClearType"
TextOptions.TextFormattingMode="Display">
<StackPanel VerticalAlignment="Center"
HorizontalAlignment="Center">
<Label>Lorem Ipsum Test</Label>
<TextBlock>Lorem Ipsum Test</TextBlock>
<TextBox Text="Lorem Ipsum"
Background="White" />
</StackPanel>
</Grid>
</ControlTemplate>
</Window.Template>
</Window>
Any suggestions? Is this a known issue that cannot be resolved?
UPDATE
With Snoop
I see a TextBoxLineDrawingVisual
, maybe this is causing the problem?
source to share