Giang Nguyen Truong
Giang Nguyen Truong

Reputation: 67

How to remove space between Grid and Button

enter image description here

I'm using Grid and Button to make an List of buttons. This is my code

<Grid Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
    </Grid.RowDefinitions>
    <Button HorizontalAlignment="Stretch" VerticalAlignment="Stretch" 
      BorderThickness="0" Background="Red" Content="dsa" Margin="0" Padding="0"/>
</Grid>

How to remove the space between the Grid with the Button ?

I tried to using padding & margin to 0, but it not affected.

Upvotes: 1

Views: 1431

Answers (2)

PKD
PKD

Reputation: 707

Have you tried adding a style tag, and using border-collapse: collapse; and/or column-gap: 0px; ? (add these to the grid, not the button)

Upvotes: 0

Chris Shao
Chris Shao

Reputation: 8231

Try to change the Margin of Button,like Margin='-10'. That will remove the space.

Upvotes: 3

Related Questions