C# 为什么ClearType部分不使用透明窗口?

C# 为什么ClearType部分不使用透明窗口?,c#,wpf,windows,xaml,transparency,C#,Wpf,Windows,Xaml,Transparency,我有一个透明的窗口,工作正常,但是文本框忽略了ClearType 设置了RenderOptions.ClearTypeHint=“Enabled”,但什么也没发生。没有其他效果,只有不透明蒙版、可视画笔、绘图画笔、剪辑或不透明AllowTransparency=“True”和AllowTransparency=“True” AllowTransparency=“True” 正常窗口上的AllowTransparency=“False” Xaml样品 Lorem同侧检验 Lorem同侧检验

我有一个透明的
窗口
,工作正常,但是
文本框
忽略了
ClearType

设置了
RenderOptions.ClearTypeHint=“Enabled”
,但什么也没发生。没有其他效果,只有不透明蒙版、可视画笔、绘图画笔、剪辑或不透明
AllowTransparency=“True”
AllowTransparency=“True”

AllowTransparency=“True”

正常窗口上的AllowTransparency=“False”

Xaml样品

Lorem同侧检验
Lorem同侧检验
有什么建议吗?这是否一个无法解决的已知问题

更新

使用
Snoop
我看到一个
TextBoxLineDrawingVisual
,可能是这导致了问题


这是因为网格对文本的附加属性(如“RenderingMode”)在内部实现为应用于“textblock”而不是“textbox”子元素。

ClearType文本不能在不完全不透明的背景上正确显示。中间渲染目标(例如效果、不透明贴图、VisualBrush、DrawingBrush、剪辑和不透明度)可以引入不完全不透明的背景。当WPF检测到文本绘制到的缓冲区可能具有透明背景时,它将禁用ClearType。从。@Sinatr我知道这一点,但是
文本框
有正常的
背景
。顺便问一下,为什么
TextBlock
<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>