调整 SymbolIcon 大小的“正确"方法是什么? [英] What is the 'right' way to resize a SymbolIcon?
问题描述
我希望能够定义样式并在图标(或包含图标的按钮上)设置样式.
I want to be able to define a style and set the style on the icon (or on the button that holds the icon).
设置按钮 h/w 不会放大符号并添加 Viewbox 有效,但我不知道如何从样式中设置它.
Setting the button h/w doesn't enlarge the symbol and adding a Viewbox works, but I can't figure out how to set that from a style.
<Button x:Name="ZoomInButton" Style="{ThemeResource HeaderButtonStyle}" Grid.Column="1" Grid.Row="0" Click="ZoomInButton_Click">
<SymbolIcon Symbol="ZoomIn" />
</Button>
非常感谢任何帮助!看起来很简单,但我很难过!
Any help very much appreciated! Seems so easy, but I'm stumped!
推荐答案
在 UWP 应用中,标准字形由 Segoe MDL2 Assets 字体提供,您可以直接使用带有 的
,因此您可以通过设置 TextBlock
FontFamily="Segoe MDL2 Assets"TextBlock
的 FontSize
来更改图标的大小.
In UWP apps, the standard glyphs are provided by the Segoe MDL2 Assets font, you can directly use a TextBlock
with FontFamily="Segoe MDL2 Assets"
, so you can change the icon's size by setting the FontSize
of the TextBlock
.
例如这里:
<Button x:Name="ZoomInButton" Style="{ThemeResource HeaderButtonStyle}" Grid.Column="1" Grid.Row="0" Click="ZoomInButton_Click">
<TextBlock FontFamily="Segoe MDL2 Assets" Text="" FontSize="30" />
</Button>
有关此字体的更多信息,您可以参考指南用于 Segoe MDL2 图标.
For more info about this font, you can refer to Guidelines for Segoe MDL2 icons.
这篇关于调整 SymbolIcon 大小的“正确"方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!