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"

enter image description here

AllowsTransparency = "False" in normal window

enter image description here

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?

enter image description here

+3


source to share


1 answer


This is because grid-bound properties for text, such as "RenderingMode", are internally implemented to be applied to "text box" rather than "text" children.



0


source







All Articles