【问题标题】:how to show grouped items (GridView group) with a format of: one big picture and the rest are small (example attached)如何以如下格式显示分组项目(GridView 组):一张大图,其余小图(附示例)
【发布时间】:2013-03-27 11:52:22
【问题描述】:

我希望 GridView 中的每个组都采用这个特定的结构/模板(一个大项目,其余项目大小相同):

项目应填满屏幕,直到按钮中没有更多空间。它应该从右到左填充(当填充一列项目时,我们填充下一列)。 我的视图模型公开了分组集合,我希望 GridView 获取每个“小”项并将其定位,就好像大项是 GridView 的“天花板”一样。

我认为这与 VariableSizedWrapGrid 有关。

这是我当前的代码(目前每个项目的大小相同,流程是从右到左):

            <GridView   
                        VerticalAlignment="Top"
                        x:Name="GridMenu"
                        ItemsSource="{Binding Source={StaticResource groupedArticlesViewSource}}"
                        ItemTemplate="{StaticResource ArticlePreviewListView}">
                <GridView.ItemsPanel>
                    <ItemsPanelTemplate>
                        <VirtualizingStackPanel Orientation="Horizontal"/>
                    </ItemsPanelTemplate>
                </GridView.ItemsPanel>
                <GridView.GroupStyle>
                    <GroupStyle>
                        <GroupStyle.HeaderTemplate>
                            <DataTemplate>
                                <Grid Margin="10">
                                    <TextBlock Text='{Binding Key}'
                                               FontFamily="{StaticResource FontFamilyStyle}"
                                               Foreground="DarkBlue"
                                               FontSize="20"/>
                                </Grid>
                            </DataTemplate>
                        </GroupStyle.HeaderTemplate>

                        <GroupStyle.Panel>
                            <ItemsPanelTemplate>
                                <VariableSizedWrapGrid Orientation="Vertical"/>
                            </ItemsPanelTemplate>
                        </GroupStyle.Panel>
                    </GroupStyle>
                </GridView.GroupStyle>
            </GridView>

【问题讨论】:

    标签: gridview windows-8 winrt-xaml itemspaneltemplate


    【解决方案1】:

    您应该查看 microsoft 提供的示例。 See this thread on win8 develeper forum

    【讨论】:

      【解决方案2】:

      我发现了一个不错的: http://dotnet.dzone.com/articles/windows-8-beauty-tip-using

      希望它对人们有所帮助(我之所以这么写是因为我必须输入至少 30 个字符:))

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2015-12-12
        • 2017-05-01
        • 2014-03-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多