如何将MahApps MetroCircleButtonStyle图标下添加文本? [英] How to add Text under a MahApps MetroCircleButtonStyle icon?

查看:1754
本文介绍了如何将MahApps MetroCircleButtonStyle图标下添加文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用与他们在窗口底部弹出控制WPF应用程序的MahApps地铁控制。我使用像这样的MetroCircleButtonStyle按钮:

I am using the MahApps Metro controls in a WPF application with their FlyOut control on the bottom of the window. I am using their MetroCircleButtonStyle button like so:

    <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>

我的问题是我怎么在弹出的添加这些图标下的文字?

My question is how do I add Text below these icons in the flyout?

史蒂夫

推荐答案

是这样的:

<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>

更新:

MetroCircleButtonStyle 本身并不能容纳的椭圆外文本。这是模板是pretty多用1单元格,在彼此的前3名儿童(椭圆一格,另一个椭圆键,最上面的是内容presenter )。文本中实际上并没有任何状态变化做出反应要么,所以这种风格外文本作为一个的TextBlock <包裹按钮没有文字一样好/ code>中说一个的StackPanel

MetroCircleButtonStyle by itself does not accomodate for Text outside the Ellipse. It's Template is pretty much a Grid with 1 cell and 3 children on top of each other(Ellipse, Another Ellipse and top-most is the ContentPresenter). Text inside does not actually respond to any state change either, So text outside with this Style is as good as wrapping the Button without text with a TextBlock in say a StackPanel.

您要查找的内容,你可以使用的 AppBarButton 。请注意文档状态,由于此控制问题,AppBarButton是由于1.0版本被删除,以便使用,作为一个例子,并建立自己的控制用类似风格。可能跌落视框,如果你的按钮尺寸是固定的。

What you're looking for, you could use the AppBarButton. Do note the documentation states, Due to issues with this control, AppBarButton is due to be removed for v1.0 so use that as an example and build up your own control with a similar Style. Probably drop the ViewBox, if your Button sizes are fixed.

这篇关于如何将MahApps MetroCircleButtonStyle图标下添加文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆