xvdiff
xvdiff

Reputation: 2229

Inner 'border' in WPF

Is there a way to remove the 'inner border' of a WPF button? I noticed that when a button containing text becomes too small, the text gets overlayed until it isn't visible anymore, even if there's technically enough space to display it.

I already played around with padding & content alignment, but no luck.

enter image description here

enter image description here

Upvotes: 3

Views: 1884

Answers (1)

ndonohoe
ndonohoe

Reputation: 10240

The content presenter on the default button style has a margin of 2, this will cause the issue you are seeing once the button gets quite small.

Try doing this to see if that is the problem you are having

<Button Content="Help">
    <Button.Resources>
        <Style TargetType="{x:Type ContentPresenter}">
            <Setter Property="Margin" Value="0"/>
        </Style>
    </Button.Resources>
</Button>

If it fixes the problem then a better solution will be to override the default button style, this page should help http://msdn.microsoft.com/en-us/library/ms753328(v=vs.110).aspx

Upvotes: 6

Related Questions