【发布时间】:2012-09-28 11:43:00
【问题描述】:
我正在将数据绑定到我的 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>
任何帮助都会很棒,而且我对此很陌生,尽可能简单:) 谢谢
【问题讨论】:
标签: c# xaml data-binding windows-8 windows-runtime