反序列化整个FlowDocument的问题

我有以下字符串反序列化整个FlowDocument的问题

<FlowDocument xml:space="preserve" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"><Paragraph>Some text <LineBreak /><LineBreak /> <Run FontWeight="bold">Text ...</Run><LineBreak />sjhfdjsgfjsd <LineBreak /><LineBreak /> <Run FontWeight="bold">Text 2 </Run><LineBreak />sdkfskfjsf <LineBreak /><LineBreak /> </Paragraph></FlowDocument> 

我尝试使用此代码,将其反序列化到FlowDocument的,但没有成功。

任何线索我失踪了?

谢谢!

CODE

StringReader stringReader = new StringReader(xamlString); 

XmlReader xmlReader = XmlReader.Create(stringReader);

Section sec = XamlReader.Load(xmlReader) as Section;

FlowDocument doc = new FlowDocument();

while (sec.Blocks.Count > 0)

doc.Blocks.Add(sec.Blocks.FirstBlock);

return doc;

回答:

OK.I发现了它。

var stringReader = new StringReader(xamlString); 

var xmlReader = XmlReader.Create(stringReader);

var doc= XamlReader.Load(xmlReader) as FlowDocument;

以上是 反序列化整个FlowDocument的问题 的全部内容, 来源链接: utcz.com/qa/257118.html

回到顶部