目前,我正在使用MahApps.Metro风格的UI设计WPF应用程序。MahApps提供的瓦片控件不能在瓦片中心显示图标
我在MahApps网站上看到了一个例子,它可以将图像显示为平铺背景,但我不知道如何显示图标而不是图像(图标,如IE徽标,人物徽标,地图徽标等)
如果有人能教我怎么做,我将不胜感激
谢谢
发布于 2014-11-13 20:55:26
我想通了
使用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>感谢任何人注意到这一点,希望能有所帮助。
发布于 2018-04-22 13:35:44
你可以使用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/"https://stackoverflow.com/questions/26900359
复制相似问题