1

次のように、データを ZoomedOut セマンティック ズームにバインドしています。

var result = from title in _allTitles group title by title._titleSubject into grp orderby     grp.Key select grp;
groupedTitlesSource.Source = result;
(semanticZoom.ZoomedOutView as ListViewBase).ItemsSource = groupedTitlesSource.View.CollectionGroups;

Group.Key を使用してキーにアクセスしていますが、グループの最初の項目にもアクセスしたいのですが、これを行う最も簡単な方法は何ですか? 私のXamlはZoomedOutViewの下にあります:

            <SemanticZoom.ZoomedOutView>
                <GridView x:Name="zoomedOutGridView" HorizontalAlignment="Center">
                    <GridView.ItemTemplate>
                        <DataTemplate>
                            <Grid Width="210" Height="140" Background="#CC196CFF">
                                <TextBlock
                                    Text="{Binding Group.Key}"
                                    FontFamily="Segoe UI Light"
                                    FontSize="24"
                                    Foreground="White"
                                    VerticalAlignment="Top"/>

                                <!-- Also want to access the first item in the group here -->
                            </Grid>    
                        </DataTemplate>
                    </GridView.ItemTemplate>
                    <GridView.ItemsPanel>
                        <ItemsPanelTemplate>
                            <WrapGrid />
                        </ItemsPanelTemplate>
                    </GridView.ItemsPanel>
                </GridView>
            </SemanticZoom.ZoomedOutView>

どんな助けでも素晴らしいでしょう、そして私はこれに非常に慣れていないので、できるだけ単純です:)ありがとう

4

1 に答える 1

0

まず、Group.Key を GridView.GroupStyle に配置し、項目を GridView.ItemTemplate の下に配置する必要があります。これにより、グループ アイテム自体にアクセスできるようになります。

于 2012-10-29T08:14:54.073 に答える