我有一个按钮,我想用它来启动视频播放,所以它应该看起来像一个 "播放 "按钮。这个按钮在屏幕上会相当大。这是我目前所拥有的。
<Button Style="{StaticResource PlayButton}">
<SymbolIcon Symbol="Play"/>
</Button>
PlayButton资源定义了200px的最小高度和最小宽度。这个问题是播放图标非常小,大约16px左右。怎样才能让它变大呢? 我试过在Button声明中设置FontSize="200",但没有任何区别。
不知道这是否是最好的方法 但对我来说是可行的,对你来说也是可行的
<Button Style="{StaticResource PlayButton}">
<Viewbox MaxHeight="200" MaxWidth="200">
<SymbolIcon Symbol="Play"/>
</Viewbox>
</Button>
你可以用一个 TextBlock
与 FontFamily="Segoe UI Symbol" Text=""
然后设定 FontSize
作品。如果你看一下 Symbol
值--你可以看到57602的值是 Play
符号枚举,对应于 "Segoe UI符号 "中的字符代码。更典型的是,这些值与它们的十六进制值一起书写,例如 Text=""
但如果你看一下那个枚举的文档,小数点会更容易找到。
另一个简单的解决方案是使用RenderTransform。例如
<AppBarButton Icon="Previous" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5" >
<AppBarButton.RenderTransform>
<CompositeTransform ScaleX="1.4" ScaleY="1.4"/>
</AppBarButton.RenderTransform>
</AppBarButton>
<Button.Content>
<TextBlock Style="{StaticResource SymbolTextBlockStyle}"
Text=""/>
</Button.Content>
<Style x:Key="SymbolTextBlockStyle" TargetType="TextBlock">
<Setter Property="FontFamily" Value="Segoe MDL2 Assets"/>
<Setter Property="FontSize" Value="16"/>
</Style>
你可以将图标作为文本块插入,并改变字体大小、颜色等。