Question

I have a toolbar with buttons that contain images. The png's are with 100x100 Px size. Because that's a bit too much I set the height of the toolbar to 30 with a style:

    <Style TargetType="ToolBar">
        <Setter Property="Height" Value="30" />
    </Style>

Now I randomly found out following: if I have the same buttons in the ToolBarOverflowPanel they have the size of the image 100x100. I have tried to set the height of the buttons in the ToolBarOverflowPanel with styles but couldn't make it.

Can someone help?

Était-ce utile?

La solution

Don't set the Height of the ToolBar or the Button instead try setting the Height of the Image control.

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

Samples - ToolBarControl

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top