首先,SVG是一种用XML定义的语言,用来描述二维矢量及矢量/栅格图形。
接下来加载步骤:
1.在安装nuget包:SharpVectors
2.引入命名空间
xmlns:svgc="http://sharpvectors.codeplex.com/svgc/"
3.将svg文件添加为项目资源后,在设计页面添加<svgc:SvgViewbox Height="100" Width="100" IsHitTestVisible="False" Source="/Resources/Trace.svg"/>
<Window x:Class="TestHandy.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:svgc="http://sharpvectors.codeplex.com/svgc/"
xmlns:local="clr-namespace:TestHandy"
xmlns:hc="https://handyorg.github.io/handycontrol"
mc:Ignorable="d"
Title="MainWindow"
Height="450"
Width="800">
<Grid >
<svgc:SvgViewbox Height="100" Width="100" IsHitTestVisible="False" Source="/Resources/Trace.svg"/>
</Grid>
</Window>