如何在XAML中增加SymbolIcon的大小?

Mik*_*ike 22 wpf xaml windows-store-apps win-universal-app

我有一个按钮,我想用它来启动视频播放,所以它应该看起来像一个"播放"按钮.屏幕上的按钮相当大.这是我到目前为止:

<Button Style="{StaticResource PlayButton}">
    <SymbolIcon Symbol="Play"/>                                
</Button>
Run Code Online (Sandbox Code Playgroud)

PlayButton资源定义MinPeight和MinWidth为200px.这个问题是播放图标非常小,大约16px左右.我怎样才能让它变大?我尝试在Button声明中设置FontSize ="200",但没有区别.

Mik*_*ike 38

不确定这是否是最好的方法,但它对我有用,可能对你有用:

<Button Style="{StaticResource PlayButton}">
    <Viewbox MaxHeight="200" MaxWidth="200">
        <SymbolIcon Symbol="Play"/>                                
    </Viewbox>
</Button>
Run Code Online (Sandbox Code Playgroud)


Fil*_*kun 10

您可以使用TextBlockwith FontFamily="Segoe UI Symbol" Text="&#57602;"然后设置FontSize作品.如果查看Symbol值 - 您可以看到57602是Play符号枚举的值,它对应于"Segoe UI符号"中的字符代码.更典型的是,这些值使用十六进制值编写Text="&#xE102;",但如果查看枚举文档,则更容易找到小数.


And*_*der 6

另一个简单的解决方案是使用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>
Run Code Online (Sandbox Code Playgroud)