FlowDocument contents as text
What is the best way to get back the XAML/XML value of a FlowDocument?
I noticed there isn't a .Value, .Text, .Caption, .ToXml(), etc...
UDPATE:
I'd like to be able to get access to it initially to serialize to disk or database. Treat it as its own document format. Later translating it to other formats would be nice.
Also been wondering:
Any equivalent to a hyperlink (opens in new browser window) in a FlowDocument? Any workaround?
In response to your first question, you can use the XamlWriter to get XAML as a string. For example:
XamlWriter.Save(flowDocument);
David Veeneman has a nice example of this in the FlowDocumentToXamlConverter implementation he created for his Bindable WPF RichTextBox.
His converter will also convert back from a string containing XAML to a FlowDocument, which should handle your persistence requirement.
On your second question, you can embed WPF's Hyperlink element in a FlowDocument. These StackOverflow questions have more details:
Tip: You should split your questions apart to get faster and better responses on StackOverflow. It prevents "oh, just one more thing..." fatigue!
如何使用XamlWriter?
链接地址: http://www.djcxy.com/p/50492.html上一篇: WPF中的多页面FlowDocument
下一篇: FlowDocument内容作为文本