WPF iconfont 矢量字体图标基本使用
<Window.Resources>
<Style TargetType="Button">
<Setter Property="FontFamily" Value="./Resources/#SF2015"/>
</Style>
</Window.Resources>
<Grid>
<StackPanel Margin="30" >
<Button FontFamily="./Resources/#SF2015" Content="安卓" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="50" />
<Button Content="苹果" FontSize="50" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0 20 0 0" />
</StackPanel>
</Grid>

"./Resources/#SF2015" 是字体在项目中的相对路径,SF2015是字体名称。可以放在 style 中,也可以放在单独控件中。
浙公网安备 33010602011771号