Wpf ResourceDictionary中的FlowDocument中的命名元素

Wpf ResourceDictionary中的FlowDocument中的命名元素,wpf,flowdocument,resourcedictionary,Wpf,Flowdocument,Resourcedictionary,我有一个FlowDocument(我需要生成的报告的模板)存储为资源。这似乎工作得很好,但如果我命名元素,就无法使用FindName()获得对它们的引用 以下是资源字典: <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <FlowDocu

我有一个FlowDocument(我需要生成的报告的模板)存储为资源。这似乎工作得很好,但如果我命名元素,就无法使用FindName()获得对它们的引用

以下是资源字典:

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <FlowDocument x:Key="ReportStructure">
        <Paragraph Name="ClientAddressParagraph" />
    </FlowDocument>
</ResourceDictionary>

有什么想法吗?我是否需要对流程文档进行某种初始化,以便它注册命名元素的名称?

如果在段落中添加一些内容,然后显示流程文档,是否看到段落?正在等待下载出现内容,但引用仍然为空。请尝试不将FlowDocument放入ResourceDictionary或使用
Dim _ReportResources = New ResourceDictionary() With {.Source = New Uri("/Reports/Statement.xaml", UriKind.Relative)}
Dim _FlowDocument As FlowDocument = _ReportResources.Item("ReportStructure")
Dim _Paragraph As Paragraph = _FlowDocument.FindName("ClientAddressParagraph")

' _Paragraph is Nothing (null) at this point.