我有一个像这样开头的 Xaml 文件:
<FlowDocument
x:Name="flowDocument"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Drawing="clr-namespace:System.Drawing;assembly=System.Drawing"
当前的解决方案使用 StremReader 通过使用流文档引用 xaml 文件的物理路径,然后将数据解析到模板中。
这不是一个有效的解决方案,所以我需要在不参考物理路径的情况下获取流文档。
我想在我的 C# 代码中使用 xmlns 命名空间或类似名称,并且喜欢
string result = XamlWriter.Save(flowDocument)
并使用结果进行解析。
建议?