【问题标题】:show the content and the background in a button在按钮中显示内容和背景
【发布时间】:2012-07-07 22:09:55
【问题描述】:

我需要在一个按钮中显示一个文本和一个图像(我的意思是一个在按钮的顶部,另一个在按钮的底部,所以两者都可以很好地看到)所以我将图像作为背景,将文本作为按钮的内容,但它把两者放在同一个空间,所以它们看起来很混合,我怎样才能分离内容和背景? 感谢您的帮助。

【问题讨论】:

标签: c# wpf


【解决方案1】:

Button 可以包含任何内容。在这种情况下,在 Button 中创建一个StackPanel 并添加内容:

<Button>
  <StackPanel>
    <TextBlock />
    <Image />
  </StackPanel>
</Button>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-12-05
    • 2013-02-11
    • 1970-01-01
    • 2020-06-19
    • 2019-07-28
    • 1970-01-01
    • 2023-02-13
    • 1970-01-01
    相关资源
    最近更新 更多