簡體   English   中英

如何顯示以下格式的分組項目(GridView組):一張大圖片,其余小圖片(附加示例)

[英]how to show grouped items (GridView group) with a format of: one big picture and the rest are small (example attached)

我希望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>

您應該查看Microsoft提供的示例。 在win8 develeper論壇上查看此線程

我找到了一個很好的網站: http : //dotnet.dzone.com/articles/windows-8-beauty-tip-using

希望對大家有所幫助(我寫道,因為我必須輸入至少30個字符:)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM