在WPF中,我以前在ResourceDictionary中有向量图标,如下所示:
<PathGeometry x:Key="BackIconGeometry">M9.5,0 L16,0 8.75,7 22,7 22,11 8.75,11 16,18 9.5,18 0,9 z</PathGeometry>并在应用程序中引用如下所示:
<Path Data="{StaticResource BackIconGeometry}" Style="..." />在UWP中,我得到了错误:
类型'String‘的值不能添加到'PathFigureCollection’类型的集合或字典中
如何将图标数据存储在资源字典中?我希望避免将它们存储为<Style TargetType="Path" />,因为我希望对图标使用不同的样式。
发布于 2016-12-07 14:54:23
Path是用于绑定的实际字符串值,因此不要使用PathGeometry,而是在资源字典中使用x:String。
<Application.Resources>
<x:String x:Key="BackIconGeometry">M9.5,0 L16,0 8.75,7 22,7 22,11 8.75,11 16,18 9.5,18 0,9 z</x:String>
</Application.Resources>在XAML中,您可以使用如下所示。
<Path Data="{StaticResource BackIconGeometry}" />https://stackoverflow.com/questions/41020372
复制相似问题