我将数据绑定到我的 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>
任何帮助都会很棒,而且我对此很陌生,尽可能简单:)谢谢