MahApps Metro Tile Icon未显示

时间:2014-11-13 02:31:03

标签: wpf vb.net mahapps.metro

目前我正在使用MahApps.Metro样式UI设计WPF应用程序。 由MahApps提供的平铺控件无法在平铺中心显示图标

我在MahApps网站上看到了可以将图像显示为图块背景的示例,但我无法弄清楚如何显示图标而不是图像(图标,如IE徽标,人物徽标,地图徽标等)< / p>

如果有人能告诉我怎么做,我很感激

谢谢

2 个答案:

答案 0 :(得分:5)

我弄明白了

使用icons.xaml作为资源,并在tile中添加矩形控件,这里是如何在tile控件中显示字符的示例

<Controls:Tile x:Name="mahTileExit"  Background="Green"   Foreground="Yellow"   Title="Exit" Width="100" Height="100" TiltFactor ="4" Margin="936,404,0,0" VerticalAlignment="Top" HorizontalAlignment="Left">
                <Rectangle Fill="White" Height="45" Width="45">
                    <Rectangle.OpacityMask>
                        <VisualBrush Visual="{StaticResource appbar_door_leave}" Stretch="Fill" />
                    </Rectangle.OpacityMask>
                </Rectangle>
        </Controls:Tile>
谢谢,如果有人注意到这一点,希望可以帮助贡献

答案 1 :(得分:0)

您可以使用包含更多图标且需要更少代码的FontAwesome.Wpf

<Controls:Tile Width="300" Height="150" Grid.Column="0" Grid.Row="1" Title="Hello!">
    <Grid Width="50" Height="50">
        <fa:ImageAwesome Icon="Flag" Foreground="#FFFFFF"/>
    </Grid>
</Controls:Tile>

不要忘记调用命名空间

xmlns:fa="http://schemas.fontawesome.io/icons/"
相关问题