I'm developing an UWP app and I'm trying to align horizontally my items in each gridview groups
I have this :
GROUP 1
Data 1 | Data 2 | Data 3
Data 1 | Data 2 | Data 3
Data 1 | Data 2 | Data 3
GROUP 2
Data 1 | Data 2 | Data 3
Data 1 | Data 2 | Data 3
and I want this :
GROUP 1
______________________________Data 1 | Data 2 | Data 3
______________________________Data 1 | Data 2 | Data 3
______________________________Data 1 | Data 2 | Data 3
GROUP 2
______________________________Data 1 | Data 2 | Data 3
______________________________Data 1 | Data 2 | Data 3
I order to align my items I use a WrapGrid. I also tried with a non grouped gridview and my code works fine.
<GridView Grid.Column="0" ItemsSource="{Binding Source={StaticResource GroupBycodeFamille}}" ItemTemplate="{StaticResource DataTempateCatalogue}">
<GridView.GroupStyle>
<GroupStyle>
<GroupStyle.HeaderTemplate>
<DataTemplate x:DataType="viewModels:GroupInfoList">
<TextBlock Text="{x:Bind Key}" Style="{ThemeResource TitleTextBlockStyle}"/>
</DataTemplate>
</GroupStyle.HeaderTemplate>
</GroupStyle>
</GridView.GroupStyle>
<GridView.ItemsPanel>
<ItemsPanelTemplate>
<WrapGrid Orientation="Horizontal" HorizontalAlignment="Center"/>
</ItemsPanelTemplate>
</GridView.ItemsPanel>
</GridView>
See Question&Answers more detail:os