Windows 8 的 SemanticZoom 控制項支援對 GridView 與 ListView 進行語意縮放,提供兩種檢視模式:
<SemanticZoom>
<SemanticZoom.ZoomedOutView>
<!-- 此處放置縮放索引檢視的 GridView,通常綁定 Group.Title -->
</SemanticZoom.ZoomedOutView>
<SemanticZoom.ZoomedInView>
<!-- 此處放置一般詳細資料的 GridView -->
</SemanticZoom.ZoomedInView>
</SemanticZoom>
Source:資料來源綁定屬性。IsSourceGrouped:是否啟用群組。View:取得目前關聯的檢視物件。View.CollectionGroups:傳回該檢視關聯的所有群組集合。<Grid.Resources>
<CollectionViewSource x:Name="itemcollectSource" IsSourceGrouped="true" ItemsPath="ItemContent" />
</Grid.Resources>
完整 XAML 程式碼請參考原文,重點包括:
WrapGrid 版面配置,ItemTemplate 綁定 Group.GroupTitle 顯示群組標題。ItemsSource="{Binding Source={StaticResource itemcollectSource}}",使用 VariableSizedWrapGrid 版面,定義 GroupStyle 顯示群組標題按鈕。透過 SemanticZoom 與 CollectionViewSource 搭配,即可輕鬆實作具備語意縮放功能的資料瀏覽介面,提升觸控裝置上大量資料的導覽效率。