我正在开发 WPF/XAML 界面。使用 SharpVector.Reloaded 包,我想在图像组件内显示 SVG 图像文件。源文件位于我的硬盘上。
如果我使用文件的绝对路径:
<Image x:Name="imImage" Grid.Column="1" Source="{svgc:SvgImage Source=W:/Labo/WPF/SVG/SVG/Resources/Images/Ghost.svg}"/>
一切正常,图像可见。
现在我想将路径变为相对路径。我尝试了所有我能想到的方法来做到这一点,但没有办法!即使下面的代码(通常应该与 Source 属性一起使用)在这里也不起作用:
<Image x:Name="imImage" Grid.Column="1" Source="{svgc:SvgImage Source=pack://siteoforigin:,,,/Resources/Images/Ghost.svg}"/>
这样做我得到了 9 个错误的列表:
Error XDG0052 The unnamed argument "" must appear before named arguments. SVG MainWindow.xaml 18
Error XLS0112 Expected ''. SVG MainWindow.xaml 18
Error XLS0414 The type '' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built. SVG MainWindow.xaml 18
Error XLS0112 Expected ''. SVG MainWindow.xaml 18
Error XLS0414 The type '' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built. SVG MainWindow.xaml 18
Error XLS0112 Expected ''. SVG MainWindow.xaml 18
Error XLS0414 The type '' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built. SVG MainWindow.xaml 18
Error XLS0112 Expected '}'. SVG MainWindow.xaml 18
Error XLS0112 Expected '
那么有人可以解释一下我在这里做错了什么,以及在上述上下文中声明相对路径的如此保密的秘密是什么?
另外一个问题是,为什么 WPF 需要使相对路径使用起来如此复杂?
绝地无双
相关分类