如何在 wpf c# 中将字符串资源中的文本添加为​​段落文本?

how to add text from a string resource as a paragraph text in wpf c#?

我有一个流程文档,我想在它的段落中添加来自字符串资源的文本,你该怎么做?

<FlowDocument>
      <Paragraph>
         //string from resource//
      </Paragraph>
</FlowDocument>

在xaml中绑定:

<FlowDocument>
      <Paragraph>
        <Run Text={StsticResource yourString} />
     </Paragraph>
</FlowDocument>

在后面的代码中:
在 xaml 中添加 x:name="paragraph"。 在后面的代码中添加:

paragraph.Inlines.Add(new Run(This.Resources["yourString"]));