C# 如何更改FlowDocumentReader中选定文本的选择背景色

C# 如何更改FlowDocumentReader中选定文本的选择背景色,c#,wpf,xaml,flowdocument,adorner,C#,Wpf,Xaml,Flowdocument,Adorner,我正在尝试使FlowDocument中的选定文本使用我们的自定义主题。对于其他控件,我们使用了一种样式来覆盖默认值: <Style.Resources> ... <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="{DynamicResource trimGroundColor}"/>

我正在尝试使FlowDocument中的选定文本使用我们的自定义主题。对于其他控件,我们使用了一种样式来覆盖默认值:

    <Style.Resources>
        ...
        <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}"
                         Color="{DynamicResource trimGroundColor}"/>
    </Style.Resources>

...
但这种方法似乎不适用于我们对FlowDocument的使用。我已经尝试将这种样式应用于FlowDocument、FlowDocumentReader,以及使用snoop检查可视化树的几个步骤

最终,选择UI似乎是由AdorneDecorator中的AdornerLayer绘制的。我尝试过使用上面的风格方法,但没有成功

我们正在尝试使用默认样式在整个应用程序中执行此操作


如何更改此颜色?

可以通过修改FlowDocumentReader.SelectionBrush属性来更改颜色:

 <Style
      TargetType="FlowDocumentReader">
      <Setter Property="SelectionBrush"
              Value="{DynamicResource trimGroundBrush}"/>
 </Style>

注意:在问题中的代码示例中,我们使用的是颜色资源,而在这个解决方案中,我们使用的是画笔