我有一个xml
<FlowDocument xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"><Paragraph TextAlignment="Left" FontFamily="Arial" NumberSubstitution.CultureSource="User"><Run FontSize="15">Foo Bar</Run></Paragraph></FlowDocument>
我想将其转换为
<FlowDocument xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<Paragraph TextAlignment="Left" FontFamily="Arial" NumberSubstitution.CultureSource="User">
<Run FontSize="15">Foo Bar</Run>
</Paragraph>
</FlowDocument>
我不知道该怎么做?这个 XML 是由动态生成的XamlWriter.Save
,这个函数返回的内容变成了这样的文本框的文本
TxtBox1.Text = XamlWriter.Save(MyFlowDocument);