Стек WinRT GridView

В приложении по умолчанию есть вид сетки, который отображает группы данных, сложенные друг над другом (2 поля высотой для каждой группы).

Когда я реализую свой вид сетки, он не складывается. Это всего лишь 1 горизонтальный список. Я сравнил свой GridView с приложением по умолчанию, и оно оказалось ОЧЕНЬ ПОХОЖИМ. Есть ли команда, которую мне не хватает, или мне нужно настроить свои данные по-другому?

Любая помощь приветствуется.

Мой GridView:

<GridView
    x:Name="itemGridView"
    AutomationProperties.AutomationId="vehicleGridView"
    AutomationProperties.Name="vehicles"
    TabIndex="1"
    Grid.Row="1"
    Margin="83,0,-83,-4"
    Padding="116,0,116,46"
    ItemsSource="{Binding vehicles}"
    ItemTemplate="{StaticResource Standard250x250ItemTemplate}"
    SelectionMode="None"
    IsItemClickEnabled="True"
    ItemClick ="vehicleClick">
    <GridView.ItemsPanel>
        <ItemsPanelTemplate>
            <VirtualizingStackPanel Orientation="Horizontal"/>
        </ItemsPanelTemplate>
    </GridView.ItemsPanel>
    <GridView.GroupStyle>
        <GroupStyle>
            <GroupStyle.HeaderTemplate>
                <DataTemplate>
                    <Grid Margin="1,0,0,6">
                        <Button
                            AutomationProperties.Name="VehicleMake"
                            Content="{Binding VehicleMake}"
                            Style="{StaticResource TextPrimaryButtonStyle}"/>
                    </Grid>
                </DataTemplate>
            </GroupStyle.HeaderTemplate>
            <GroupStyle.Panel>
                <ItemsPanelTemplate>
                    <VariableSizedWrapGrid Orientation="Vertical" Margin="0,0,80,0"/>
                </ItemsPanelTemplate>
            </GroupStyle.Panel>
        </GroupStyle>
    </GridView.GroupStyle>
</GridView>

Пример по умолчанию:

   <GridView
        x:Name="itemGridView"
        AutomationProperties.AutomationId="ItemGridView"
        AutomationProperties.Name="Grouped Items"
        Grid.RowSpan="2"
        Padding="116,137,40,46"
        ItemsSource="{Binding Source={StaticResource groupedItemsViewSource}}"
        ItemTemplate="{StaticResource Standard250x250ItemTemplate}"
        SelectionMode="None"
        IsSwipeEnabled="false"
        IsItemClickEnabled="True"
        ItemClick="ItemView_ItemClick">

        <GridView.ItemsPanel>
            <ItemsPanelTemplate>                        
                <VirtualizingStackPanel Orientation="Horizontal"/>
            </ItemsPanelTemplate>
        </GridView.ItemsPanel>
        <GridView.GroupStyle>
            <GroupStyle>
                <GroupStyle.HeaderTemplate>
                    <DataTemplate>
                        <Grid Margin="1,0,0,6">
                            <Button
                                AutomationProperties.Name="Group Title"
                                Click="Header_Click"
                                Style="{StaticResource TextPrimaryButtonStyle}" >
                                <StackPanel Orientation="Horizontal">
                                    <TextBlock Text="{Binding Title}" Margin="3,-7,10,10" Style="{StaticResource GroupHeaderTextStyle}" />
                                    <TextBlock Text="{StaticResource ChevronGlyph}" FontFamily="Segoe UI Symbol" Margin="0,-7,0,10" Style="{StaticResource GroupHeaderTextStyle}"/>
                                </StackPanel>
                            </Button>
                        </Grid>
                    </DataTemplate>
                </GroupStyle.HeaderTemplate>
                <GroupStyle.Panel>
                    <ItemsPanelTemplate>
                        <VariableSizedWrapGrid Orientation="Vertical" Margin="0,0,80,0"/>
                    </ItemsPanelTemplate>
                </GroupStyle.Panel>
            </GroupStyle>
        </GridView.GroupStyle>
    </GridView>

person webdad3    schedule 29.10.2012    source источник
comment
что вы имеете в виду под стекированием, можете ли вы показать скриншот?   -  person Mayank    schedule 29.10.2012
comment
Я должен буду сделать это сегодня вечером. В основном это выглядит так, как будто он оборачивает сетку. Итак, у вас есть верхний ряд кнопок, а затем нижний ряд, когда он достигает определенной ширины. Вечером добавлю скрин.   -  person webdad3    schedule 29.10.2012
comment
Да, извините, мне очень трудно это представить, концептуальный каркас или скриншот помогут понять.   -  person Mayank    schedule 29.10.2012


Ответы (1)


Вам нужно использовать WrapGrid в вашем ItemsPanelTemplate. Попробуй это.

<ItemsPanelTemplate><WrapGrid /></ItemsPanelTemplate>
person Bitsian    schedule 30.10.2012
comment
ты прав. Я нашел это прошлой ночью и собирался обновить этот пост сегодня. Спасибо! - person webdad3; 30.10.2012