我尝试使用XamlReader.Load(XMLReader)读取XPS文件。一些XPS文件读入,我可以完美地完成。我工作的其中一个XPS文件在IE中正确显示,提供了以下异常:
Cannot convert string '/png/1.png' in attribute 'ImageSource' to object of type 'System.Windows.Media.ImageSource'. Cannot locate resource 'png/1.png'. Error at object 'System.Windows.Media.ImageBrush', Line 2309 Position 166.
当我在IE中查看文件或使用unZIP工具浏览时,有问题的图像文件位于指定地址为“png / 1.png”的XPS文件中,图像文件显示正确。
有什么想法吗?
答案 0 :(得分:0)
此问题的解决方案涉及将ParserContext设置为Load()的可选参数。