First you cannot add a FlowDocument
to a DocumentViewer
because it only supports FixedDocument
. You may use FlowDocumentScrollViewer
or FlowDocumentPageViewer
instead.
<FlowDocumentScrollViewer x:Name="TestViewer"/>
Then you have to set the Document
property in code:
TestViewer.Document = Application.LoadComponent(
new Uri("/Resources/FlowDocument1.xaml", UriKind.Relative)) as FlowDocument;