我有一个工具栏,其中包含包含图像的按钮。 png的尺寸为100x100 Px。因为这有点太多了,我用工具栏将工具栏的高度设置为30:
<Style TargetType="ToolBar">
<Setter Property="Height" Value="30" />
</Style>
现在我随机发现以下内容:如果我在ToolBarOverflowPanel中有相同的按钮,则它们的大小为100x100。 我曾尝试使用样式设置ToolBarOverflowPanel中按钮的高度,但无法实现。
有人可以帮忙吗?
答案 0 :(得分:0)
不要设置工具栏或按钮的高度,而是尝试设置图像控件的高度。
<Button Command="Test" ToolTip="Test">
<StackPanel Orientation="Horizontal">
<Image Source="/Samples;component/Images/test.png" Height="30" Width="30" />
<TextBlock Margin="3,0,0,0">Test</TextBlock>
</StackPanel>
</Button>
样本 - ToolBarControl