【发布时间】:2017-11-16 05:43:38
【问题描述】:
我正在尝试使用堆栈面板将文本放在按钮模板内的图像下,但它不起作用。只有图像可见,文本不可见。使用模板,我可以将图像作为背景填充所有按钮。见下文:
<Button Name="btnAdd" Height="36" Width="36" Click="btnAdd_Click" HorizontalAlignment="Center" Margin="10">
<Button.Template>
<ControlTemplate>
<StackPanel Orientation="Vertical">
<Image Source="/MyPath/Add.png"/>
<Label Padding="0">My Button Text</Label>
</StackPanel>
</ControlTemplate>
</Button.Template>
</Button>
如何使我的标签在图像下方居中显示并以小字体显示?
【问题讨论】:
标签: c# wpf button visual-studio-2008 .net-3.5