【问题标题】:Broken Styles when using XamlReader to parse and insert a FlowDocument into a RichTextBox使用 XamlReader 解析 FlowDocument 并将其插入 RichTextBox 时的样式损坏
【发布时间】:2009-08-12 23:44:02
【问题描述】:

我正在将 Html 转换为 Xaml(确切地说是FlowDocument)并使用XamlReader 来解析新创建的FlowDocument。然后我将新的FlowDocument 插入RichTextBox,但我的应用程序级别样式都没有应用于FLowDocument 元素,例如Hyperlinks。 我的一种风格的示例:

    <Style TargetType="{x:Type Hyperlink}">
    <Setter Property="Background" Value="DarkBlue" />
    <Setter Property="Cursor" Value="Hand" />
</Style>

谁能帮我解决这个问题? 谢谢!

【问题讨论】:

    标签: wpf xaml styles


    【解决方案1】:

    我想通了...我使用 FlowDocumentScrollViewer 而不是 RichTextBox 来查看我的 FLowDocument。由于某种原因,当容器是 RichTextBox 时,样式不会被应用...

    【讨论】:

      猜你喜欢
      • 2023-03-30
      • 1970-01-01
      • 2011-01-22
      • 2016-03-18
      • 1970-01-01
      • 2013-08-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多