I have a FlowDocument (a template for a report I need to produce) stored as a resource. This seems to work well but if I name the elements I can't get a reference to them with FindName().
Here is the resource dictionary:
<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="开发者_如何学PythonClientAddressParagraph" />
</FlowDocument>
</ResourceDictionary>
And here is my code:
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.
Any ideas? Do I need to do some kind of initialisation on the flow document so that it registers the names of named elements?
精彩评论