我将数据绑定到我的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>
任何帮助都会很棒,而且我对此非常陌生这么简单:) 感谢
答案 0 :(得分:0)
首先,你的Group.Key应该在GridView.GroupStyle中,你的项目应该在GridView.ItemTemplate下。有了它,您将能够访问组项目。