olumn="1" Margin="5,2">
30 <TextBlock Text="{Binding Title}" VerticalAlignment="Top" TextWrapping="Wrap"/>
31 </Grid>
32 </Grid>
33 </DataTemplate>
34 </ListView.ItemTemplate>
35 <ListView.ItemContainerStyle>
36 <Style TargetType="ListViewItem">
37 <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
38 <Setter Property="Margin" Value="0"/>
39 </Style>
40 </ListView.ItemContainerStyle>
41 <!--列表头-->
42 <ListView.GroupStyle>
43 <GroupStyle HidesIfEmpty="True" >
44 <GroupStyle.HeaderTemplate>
45 <DataTemplate>
46 <TextBlock Text="{Binding Key}" FontSize="25" Foreground="Red"/>
47 </DataTemplate>
48 </GroupStyle.HeaderTemplate>
49 </GroupStyle>
50 </ListView.GroupStyle>
51 </ListView>
52 </SemanticZoom.ZoomedInView>
53 <!--排序列表-->
54 <SemanticZoom.ZoomedOutView>
55 <GridView ItemsSource="{Binding Source={StaticResource CollectionViewSource},Path=CollectionGroups}">
56 <GridView.ItemsPanel>
57 <ItemsPanelTemplate>
58 <WrapGrid MaximumRowsOrColumns="4" VerticalAlignment="Top" Orientation="Horizontal"/>
59 </ItemsPanelTemplate>
60 </GridView.ItemsPanel>
61 <GridView.ItemTemplate>
62 <DataTemplate>
63 <Border Background="{Binding Converter={StaticResource BackgroundConverter}}">
64 <TextBlock Text="{Binding Group.Key}" HorizontalAlignment="Center"
65 VerticalAlignment="Center"
66 Foreground="{Binding Converter={StaticResource ForegroundConverter}}"/>
67 </Border>
68 </DataTemplate>
69 </GridView.ItemTemplate>
70
71 <GridView.ItemContainerStyle>
72 <Style TargetType="GridViewItem">
73 <Setter Property="HorizontalAlignment" Value="Center"/>
74 <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
75 <Setter Property="VerticalAlignment" Value="Center"/>
76 <Setter Property="VerticalContentAlignment" Value="Stretch"/>
77 </Style>
78 </GridView.ItemContainerStyle>
79 <GridView.Template>
80 <ControlTemplate>
81 <ScrollViewer ScrollViewer.VerticalScrollMode="Enabled">
82 <Viewbox Stretch="Uniform" Margin="8" VerticalAlignment="Top"
83 ScrollViewer.VerticalScrollMode="Enabled" StretchDirection="Both" >
84 <ItemsPresenter />
85 </Viewbox>
86 </ScrollViewer>
87 </ControlTemplate>
88 </GridView.Template>
89 </GridView>
90 </SemanticZoom.ZoomedOutView>
91 </SemanticZoom>
SemanticZoom
注意到排序列表的GridView.ItemTemplate ,用到了两个Converter,即BackgroundConverter和ForegroundConverter
|