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="&#xe60c;安卓"  HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="50" />
        <Button Content="&#xe602;苹果" FontSize="50" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0 20 0 0" />
    </StackPanel>
</Grid>

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




posted @ 2021-11-06 10:09  double64  阅读(206)  评论(0)    收藏  举报