locked
GridView with 2 Rows and horizontal scroll

    Question

  • im trying to achieve something looking like this using a GridView in a Windows Store App project enter image description here

    i can get my items in a single line with horizontal scroll, but i want to have a GridView with 2 rows

    <GridView Grid.Row="1" Margin="22,0,0,0" Style="{StaticResource GridViewStyle}" SelectionMode="None" ItemsSource="{Binding UserPhotos}"  HorizontalContentAlignment="Center" VerticalContentAlignment="Center">
                        <GridView.ItemTemplate>
                            <DataTemplate>
    
                                    <Ellipse HorizontalAlignment="Left" Height="30" Width="30" Margin="0,7,10,0">
                                        <Ellipse.Fill>
                                            <ImageBrush Stretch="Uniform" ImageSource="{Binding}"/>
                                        </Ellipse.Fill>
                                    </Ellipse>
    
                            </DataTemplate>
                        </GridView.ItemTemplate>
                    </GridView>

    what should i change/add to get this result?

    Monday, May 11, 2015 4:53 PM

Answers

  • Hi Thought2,

    We can change the GridView items layout by modifying the GridView ItemsPanel, so please try to use the ItemsWrapGrid in the GridView ItemsPanelTemplate, then if you want to let the GridView have two rows, you can set the ItemsWrapGrid.MaximumRowsOrColumns property as two and Orientation property as "Vertical", for more information please refer to the following xaml:

                <GridView.ItemsPanel>
                    <ItemsPanelTemplate>
                        <ItemsWrapGrid Orientation="Vertical" MaximumRowsOrColumns="2"></ItemsWrapGrid>
                    </ItemsPanelTemplate>
                </GridView.ItemsPanel>
    Best Regards,
    Amy Peng

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Tuesday, May 12, 2015 11:09 AM
    Moderator