英文:
How can I fill the Data Attribute of a XAML Path with a desired Icon
问题
我可以帮你翻译这部分内容。
英文:
How can I create the data for a XAML Path for a home icon in xaml?
答案1
得分: 1
以下是翻译好的部分:
我建议查看这个网站,你可以在那里找到许多图标:
https://pictogrammers.com/library/mdi/
选择你喜欢的图标,导航到标有 copy SVG
的XML符号。
现在将SVG粘贴到记事本中。将 d=""
属性的内容复制到你的路径数据 data=""
中,然后你就可以使用了。
结果:
<Path Fill="Black "Data="M19.07,4.93C17.22,3 14.66,1.96 12,2C9.34,1.96 6.79,3 4.94,4.93C3,6.78 1.96,9.34 2,12C1.96,14.66 3,17.21 4.93,19.06C6.78,21 9.34,22.04 12,22C14.66,22.04 17.21,21 19.06,19.07C21,17.22 22.04,14.66 22,12C22.04,9.34 21,6.78 19.07,4.93M17,12V18H13.5V13H10.5V18H7V12H5L12,5L19.5,12H17Z"/>
如果你想创建这种类型的资源,可以这样做:
<Geometry x:Key="DownArrowThick">M9,4H15V12H19.84L12,19.84L4.16,12H9V4Z</Geometry>
然后像这样使用它:
<Path Stretch="Fill" Fill="Hotpink" Data="{StaticResource DownArrowThick}"/>
如果你想自己创建形状,可以将位图导入Inkscape,将其转换为路径,将所有路径合并为一个对象,然后按照上面的步骤提取数据。
手动绘制这些数据虽然可能,但相对不常见。
英文:
i suggest checking out this website you can find many icons there:
https://pictogrammers.com/library/mdi/
select the icon you like, navigate to the XML symbol marked with copy SVG
.
Now paste the svg in notepad. Copy the content of the d=""
attribute into your paths data="" and you are good to go
Result:
<Path Fill="Black "Data="M19.07,4.93C17.22,3 14.66,1.96 12,2C9.34,1.96 6.79,3 4.94,4.93C3,6.78 1.96,9.34 2,12C1.96,14.66 3,17.21 4.93,19.06C6.78,21 9.34,22.04 12,22C14.66,22.04 17.21,21 19.06,19.07C21,17.22 22.04,14.66 22,12C22.04,9.34 21,6.78 19.07,4.93M17,12V18H13.5V13H10.5V18H7V12H5L12,5L19.5,12H17Z"/>
if you want to create resources of this type you can do it like this:
<Geometry x:Key="DownArrowThick">M9,4H15V12H19.84L12,19.84L4.16,12H9V4Z</Geometry>
and use it like this:
<Path Stretch="Fill" Fill="Hotpink" Data="{StaticResource DownArrowThick}"/>
If you do want to create shapes yourself you can imput bitmaps into Inkscape, converti it to a path, merge all paths to a single object and now follow the steps from above to extract the data.
Drawing this data by hand is, while possible rather uncommon.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论