Reputation: 5534
I have this GridView,
And want to remove spaces between items, I Try setting Marging and Padding to 0 as this:
<GridView ItemsSource="{Binding ElementName=AprehenderPage,Path=DataContext.LecturasCorrectas}"
Margin="0"
Padding="0">
<GridView.ItemTemplate>
<DataTemplate>
<Grid Height="35"
Margin="0"
Padding="0">
<Image Source="{Binding Imagen}"
Margin="0"/>
</Grid>
</DataTemplate>
</GridView.ItemTemplate>
</GridView>
But this does nothing.
How Can I do to remove those spaces?
or
What other control must I use?
Upvotes: 0
Views: 1821
Reputation: 804
It looks like you might be using UWP rather than WPF as I don't think WPF GridView has an ItemsSource. If that's the case, then your margin is probably from GridViewItem:
GridViewItem (the container object) has Margin according to MSDN:
https://msdn.microsoft.com/en-us/library/windows/apps/mt299127.aspx
So you'll need to restyle the item like so:
<Style x:Key="MyItem" TargetType="GridViewItem">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Margin" Value="0"/>
<Setter Property="Padding" Value="0"/>
</Style>
And have a setter on your gridview for container style:
<Setter Property="ItemContainerStyle" Value="{StaticResource MyItem}" />
Upvotes: 3
Reputation: 888
Try auto height.
<Grid Height="Auto" ...
Also you can have negative margins if need be
and margins like..
Margin ="-value"
Upvotes: 0