如何在MahApps MetroCircleButtonStyle图标下添加文本?

Org*_*rat 1 wpf xaml button mahapps.metro

我在WPF应用程序中使用MahApps Metro控件,并在窗口底部使用FlyOut控件.我正在使用他们的MetroCircleButtonStyle按钮:

    <Button Width="55"
        Height="55"
        VerticalAlignment="Top"
        Style="{DynamicResource MetroCircleButtonStyle}">
  <Rectangle Width="20"
              Height="20">
    <Rectangle.Fill>
      <VisualBrush Stretch="Fill"
                    Visual="{StaticResource appbar_city}" />
    </Rectangle.Fill>
  </Rectangle>  
</Button>
Run Code Online (Sandbox Code Playgroud)

我的问题是如何在弹出窗口中的这些图标下面添加文字?

史蒂夫

Viv*_*Viv 5

就像是:

<Button Width="55"
        Height="55"
        VerticalAlignment="Top"
        Style="{DynamicResource MetroCircleButtonStyle}">
  <StackPanel Orientation="Vertical">
    <Rectangle Width="20"
                Height="20">
      <Rectangle.Fill>
        <VisualBrush Stretch="Fill"
                      Visual="{StaticResource appbar_city}" />
      </Rectangle.Fill>
    </Rectangle>
    <TextBlock Text="Hello" />
  </StackPanel>
</Button>
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

更新:

MetroCircleButtonStyle本身不适用于椭圆之外的文本.它Template几乎是一个网格,有1个单元格和3个孩子在彼此之上(Ellipse另一个Ellipse和最顶层的是ContentPresenter).内部文本实际上也不会响应任何状态更改,因此使用此样式外部的Button文本与使用a TextBlock表示包装无文本一样好StackPanel.

您正在寻找什么,您可以使用AppBarButton.请注意文档的状态,Due to issues with this control, AppBarButton is due to be removed for v1.0因此请将其作为示例,并使用类似的方法构建您自己的控件Style.ViewBox如果Button尺寸固定,可能会掉落.