Carl Rippon
Carl Rippon

Reputation: 4673

Button Content Margin

I can't work out how to get rid of the margin around a button's content. Here is some example XAML:

<Button Background="Red" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
    <Grid Background="Blue" Margin="0">
        <TextBlock Text="me" Padding="0"></TextBlock>
    </Grid>
</Button>

I can't seem to get rid of the red bit. Has anyone got any ideas?

Upvotes: 1

Views: 6155

Answers (1)

Nilesh Gule
Nilesh Gule

Reputation: 1621

You need to change the control template for the button. You can have alook at the following links http://mark-dot-net.blogspot.com/2007/07/creating-custom-wpf-button-template-in.html http://msdn.microsoft.com/en-us/magazine/cc163497.aspx

Upvotes: 2

Related Questions