1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
|
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Facebook.Client.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<local:ScaleConverter x:Key="ScaleConverter" />
<local:SizeToGridCellConverter x:Key="SizeToGridCellConverter" />
<local:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
<local:PickerSelectionModeConverter x:Key="PickerSelectionModeConverter" />
<DataTemplate x:Name="GroupTemplate">
<Border
Background="{Binding Tag.GroupHeaderBackground, ElementName=PART_SemanticZoom}"
Width="{Binding ElementName=PART_SemanticZoom, Converter={StaticResource SizeToGridCellConverter}, ConverterParameter=True}"
Height="{Binding ElementName=PART_SemanticZoom, Converter={StaticResource SizeToGridCellConverter}, ConverterParameter=False}">
<TextBlock
Margin="10"
Foreground="{Binding Tag.GroupHeaderForeground, ElementName=PART_SemanticZoom}"
Text="{Binding Key}"
Style="{StaticResource GroupHeaderTextStyle}" />
</Border>
</DataTemplate>
<DataTemplate x:Name="EmptyGroupTemplate">
<Border
Background="Gray"
Width="{Binding ElementName=PART_SemanticZoom, Converter={StaticResource SizeToGridCellConverter}, ConverterParameter=True}"
Height="{Binding ElementName=PART_SemanticZoom, Converter={StaticResource SizeToGridCellConverter}, ConverterParameter=False}">
<TextBlock
Margin="10"
Foreground="{Binding Tag.GroupHeaderForeground, ElementName=PART_SemanticZoom}"
Text="{Binding Key}"
Style="{StaticResource GroupHeaderTextStyle}" />
</Border>
</DataTemplate>
<DataTemplate x:Key="ZoomedOutItemTemplate">
<ContentControl
DataContext="{Binding Group}"
Content="{Binding DataContext, RelativeSource={RelativeSource Mode=Self}}">
<ContentControl.ContentTemplateSelector>
<local:FriendPickerGroupTemplateSelector
GroupTemplate="{StaticResource GroupTemplate}"
EmptyGroupTemplate="{StaticResource EmptyGroupTemplate}" />
</ContentControl.ContentTemplateSelector>
</ContentControl>
</DataTemplate>
<!--see http://msdn.microsoft.com/library/windows/apps/jj709917.aspx-->
<Style x:Key="GroupItemStyle" TargetType="GroupItem">
<Setter Property="IsTabStop" Value="False" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="GroupItem">
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<ContentControl
x:Name="HeaderContent"
Content="{TemplateBinding Content}"
ContentTransitions="{TemplateBinding ContentTransitions}"
ContentTemplate="{TemplateBinding ContentTemplate}"
ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
Margin="{TemplateBinding Padding}"
TabIndex="0"
IsTabStop="False"
HorizontalContentAlignment="Stretch" />
<ItemsControl
x:Name="ItemsControl"
Grid.Row="1"
ItemsSource="{Binding GroupItems}"
IsTabStop="False"
TabNavigation="Once"
TabIndex="1">
<ItemsControl.ItemContainerTransitions>
<TransitionCollection>
<AddDeleteThemeTransition />
<ContentThemeTransition />
<ReorderThemeTransition />
<EntranceThemeTransition IsStaggeringEnabled="False" />
</TransitionCollection>
</ItemsControl.ItemContainerTransitions>
</ItemsControl>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<DataTemplate x:Name="GroupHeaderTemplate">
<Border
HorizontalAlignment="Stretch"
BorderBrush="{Binding Tag.GroupHeaderBackground, ElementName=PART_SemanticZoom}"
Margin="4,0,18,0"
BorderThickness="0,0,0,1">
<Border
MinWidth="50"
HorizontalAlignment="Left"
Background="{Binding Tag.GroupHeaderBackground, ElementName=PART_SemanticZoom}">
<TextBlock
Text="{Binding Key}"
Margin="10"
Foreground="{Binding Tag.GroupHeaderForeground, ElementName=PART_SemanticZoom}"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Style="{StaticResource GroupHeaderTextStyle}" />
</Border>
</Border>
</DataTemplate>
<DataTemplate x:Name="ZoomedInItemTemplate">
<StackPanel Orientation="Horizontal" Margin="0,4">
<Image
Width="{Binding Parent.PictureSize.Width}"
Height="{Binding Parent.PictureSize.Height}"
Stretch="UniformToFill"
Margin="0, 0, 10, 0"
Visibility="{Binding Parent.DisplayProfilePictures, Converter={StaticResource BooleanToVisibilityConverter}}"
Source="{Binding Item.ProfilePictureUrl}" />
<TextBlock
HorizontalAlignment="Left"
VerticalAlignment="Top"
Margin="5"
TextWrapping="Wrap"
Text="{Binding DisplayName}"
Style="{StaticResource ItemTextStyle}" />
</StackPanel>
</DataTemplate>
<Style TargetType="local:FriendPicker">
<Setter Property="GroupHeaderForeground" Value="White" />
<Setter Property="GroupHeaderBackground" Value="#FF25A1DB" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="local:FriendPicker">
<SemanticZoom x:Name="PART_SemanticZoom"
Background="{TemplateBinding Background}">
<SemanticZoom.ZoomedInView>
<ListView
ItemsSource="{Binding}"
ItemTemplate="{StaticResource ZoomedInItemTemplate}"
SelectionMode="{Binding SelectionMode, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource PickerSelectionModeConverter}}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
ScrollViewer.IsVerticalScrollChainingEnabled="False">
<ListView.GroupStyle>
<GroupStyle
HidesIfEmpty="True"
ContainerStyle="{StaticResource GroupItemStyle}"
HeaderTemplate="{StaticResource GroupHeaderTemplate}">
</GroupStyle>
</ListView.GroupStyle>
</ListView>
</SemanticZoom.ZoomedInView>
<SemanticZoom.ZoomedOutView>
<ListView
Padding="-1"
ItemsSource="{Binding Path=CollectionGroups}"
ItemTemplate="{StaticResource ZoomedOutItemTemplate}"
SelectionMode="None"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
ScrollViewer.IsVerticalScrollChainingEnabled="False"
ScrollViewer.VerticalScrollBarVisibility="Hidden">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<WrapGrid Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="Margin" Value="0" />
<Setter Property="Padding" Value="0" />
<Setter Property="BorderThickness" Value="0" />
</Style>
</ListView.ItemContainerStyle>
</ListView>
</SemanticZoom.ZoomedOutView>
</SemanticZoom>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
|