如何增加XAML中符号的大小?

时间:2022-05-21 17:21:54

I have a button that I want to use to launch video playback, so it should look like a "Play" button. The button will be fairly large on screen. This is what I have so far:

我有一个按钮,我想用来启动视频回放,所以它应该看起来像一个“播放”按钮。屏幕上的按钮将相当大。这是我目前所拥有的:

<Button Style="{StaticResource PlayButton}">
    <SymbolIcon Symbol="Play"/>                                
</Button>

The PlayButton resource defines a MinHeight and MinWidth of 200px. The problem with this is that the play icon is very small, in the order of 16px or so. How can I make it larger? I tried setting FontSize="200" in the Button declaration, but it makes no difference.

PlayButton资源定义最小高度和最小宽度为200px。问题是play图标非常小,大约16px左右。我怎么才能把它放大?我尝试在按钮声明中设置FontSize="200",但是没有区别。

3 个解决方案

#1


30  

Not sure if this is the best way to do it, but it worked for me and might work for you:

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

<Button Style="{StaticResource PlayButton}">
    <Viewbox MaxHeight="200" MaxWidth="200">
        <SymbolIcon Symbol="Play"/>                                
    </Viewbox>
</Button>

#2


10  

You could use a TextBlock with FontFamily="Segoe UI Symbol" Text="&#57602;" and then setting FontSize works. If you look at the Symbol values - you can see the 57602 is the value of the Play symbol enum which corresponds to the character code in "Segoe UI Symbol". More typically these values are written with their hex values as in Text="&#xE102;", but the decimal is easier to find if you look at that enum's documentation.

可以使用带有FontFamily="Segoe UI符号" Text=""的TextBlock,然后设置FontSize works。如果您查看符号值——您可以看到57602是Play符号枚举的值,它对应于“Segoe UI符号”中的字符代码。更典型的是,这些值使用它们的十六进制值编写,如Text=",但如果查看枚举的文档,则更容易找到小数。

#3


5  

Another easy solution is to use RenderTransform. E.g.

另一个简单的解决方案是使用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>

#1


30  

Not sure if this is the best way to do it, but it worked for me and might work for you:

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

<Button Style="{StaticResource PlayButton}">
    <Viewbox MaxHeight="200" MaxWidth="200">
        <SymbolIcon Symbol="Play"/>                                
    </Viewbox>
</Button>

#2


10  

You could use a TextBlock with FontFamily="Segoe UI Symbol" Text="&#57602;" and then setting FontSize works. If you look at the Symbol values - you can see the 57602 is the value of the Play symbol enum which corresponds to the character code in "Segoe UI Symbol". More typically these values are written with their hex values as in Text="&#xE102;", but the decimal is easier to find if you look at that enum's documentation.

可以使用带有FontFamily="Segoe UI符号" Text=""的TextBlock,然后设置FontSize works。如果您查看符号值——您可以看到57602是Play符号枚举的值,它对应于“Segoe UI符号”中的字符代码。更典型的是,这些值使用它们的十六进制值编写,如Text=",但如果查看枚举的文档,则更容易找到小数。

#3


5  

Another easy solution is to use RenderTransform. E.g.

另一个简单的解决方案是使用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>