Wpf “集合属性”System.Windows.Documents.ListItem.“SiblingListItems”为空。当我使用Xamlservices.Load()加载xaml时
我有一个Xaml文件,其中包含该Xaml文件中的流文档和列表项。 这是我的密码Wpf “集合属性”System.Windows.Documents.ListItem.“SiblingListItems”为空。当我使用Xamlservices.Load()加载xaml时,wpf,xaml,serialization,Wpf,Xaml,Serialization,我有一个Xaml文件,其中包含该Xaml文件中的流文档和列表项。 这是我的密码 xmlns:p="http://schemas.microsoft.com/winfx/2006/xaml/presentation"; <Book> <Ins> <p:FlowDocument> <p:List StartI
xmlns:p="http://schemas.microsoft.com/winfx/2006/xaml/presentation";
<Book>
<Ins>
<p:FlowDocument>
<p:List StartIndex="1">
<p:ListItem>
<p:Paragraph>Some Text.</p:Paragraph>
</p:ListItem>
<p:ListItem>
<p:Paragraph>Some Text.</p:Paragraph>
</p:ListItem>
</p:List>
</p:FlowDocument>
</Ins>
</Book>
private FlowDocument _notes;
public FlowDocument Notes
{
get { return _notes; }
set
{
if (_notes!= value)
{
_notes= value;
RaisePropertyChanged(() => Notes);
}
}
}
我可以加载此文档。。当我试图使用XamlServices.save保存此文档时,它会在列表中生成以下额外标记
当我试图加载这个新保存的Xaml文件时,它抛出了一个错误
集合属性“System.Windows.Documents.ListItem”。“SiblingListItems”为空。在兄弟街区
我想我这里的问题是使用流文档,因为它是wpf类型的对象。我不能将流文档wpf类型的对象与XamlServices一起使用。加载。。。
对于不是wpf类型的对象的流文档,我可以有其他选择吗
我也尝试过使用XamlWriter.Save,但它不适用于我,因为我使用的是带有参数构造函数的Genric类
提前谢谢
<av:List.SiblingBlocks>
<x:Reference>__ReferenceID13</x:Reference>
</av:List.SiblingBlocks>
<av:ListItem.SiblingListItems>
<x:Reference>__ReferenceID9</x:Reference>
<x:Reference>__ReferenceID12</x:Reference>
</av:ListItem.SiblingListItems>