【问题标题】:How can I add a context to ellipse button in XAML?如何在 XAML 中向椭圆按钮添加上下文?
【发布时间】:2016-02-15 14:06:05
【问题描述】:

我正在尝试向椭圆按钮添加上下文,但我不知道如何完成它。 到目前为止,我能做的只有

<Ellipse Fill="{TemplateBinding Background}"/>

但我不想要背景,我想要文字。如果有人可以在这里帮助我,那将很有帮助..

代码如下:

<Button Grid.Column="0" Height="40" Width="40" Margin="-26,-10,26,10" FontWeight="Bold">
    <Button.Template>
        <ControlTemplate TargetType="{x:Type Button}">
            <Ellipse/>
        </ControlTemplate>
    </Button.Template>
    <Button.Content>
        Meat
    </Button.Content>
</Button>

如果你能帮到我,请复制并粘贴带有答案的代码:

【问题讨论】:

    标签: wpf xaml


    【解决方案1】:
    <ControlTemplate TargetType="{x:Type Button}">
        <Ellipse> 
          <ContentPresenter/>
        </Ellipse>
    </Grid>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-12-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-08-16
      • 2010-10-28
      • 1970-01-01
      相关资源
      最近更新 更多