Rauf
Rauf

Reputation: 12842

Remove space in between ImageButton elements in a Grid

I have to remove the white space between ImageButton in Xamarin Forms 5.

Right now I have placed the buttons in Grid cells. Each Button is in each cells.

enter image description here

Upvotes: 2

Views: 161

Answers (1)

deczaloth
deczaloth

Reputation: 7445

The Fix

To control space between Columns in a Grid use the ColumnSpacing property.

The docs states that this property controls

The space between columns in this Grid layout. The default is 6.

The Example

As an example take the following code

<Grid ColumnSpacing="0">
  <ImageButton Grid.Column="0" Grid.Row="0" BackgroundColor="Red"/>
  <ImageButton Grid.Column="1" Grid.Row="0" BackgroundColor="Blue"/>
  <ImageButton Grid.Column="2" Grid.Row="0" BackgroundColor="Green"/>
</Grid>

Which creates a three Columns Row with no space between the Column elements:

enter image description here

Upvotes: 2

Related Questions