1: // On XAML Page.
2: <GridView .... ItemContainerStyle="{StaticResource SLShowGridViewItemStyle}">
3:
4: // Global Style.
5: <Style x:Key="SLShowGridViewItemStyle" TargetType="GridViewItem">
6: <Setter Property="FontFamily" Value="{StaticResource ContentControlThemeFontFamily}"/>
7: <Setter Property="FontSize" Value="{StaticResource ControlContentThemeFontSize}"/>
8: <Setter Property="Background" Value="Transparent"/>
9: <Setter Property="TabNavigation" Value="Local"/>
10: <Setter Property="IsHoldingEnabled" Value="True"/>
11: <Setter Property="Margin" Value="0,0,2,2"/>
12: <Setter Property="Template">
13: <Setter.Value>
14: <ControlTemplate TargetType="GridViewItem">
15: <Border x:Name="OuterContainer">
16: <VisualStateManager.VisualStateGroups>
17: <VisualStateGroup x:Name="CommonStates">
18: <VisualState x:Name="Normal"/>
19: <VisualState x:Name="PointerOver">
20: <Storyboard>
21: <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PointerOverBorder"/>
22: <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="SelectionBackground">
23: <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ListViewItemSelectedPointerOverBackgroundThemeBrush}"/>
24: </ObjectAnimationUsingKeyFrames>
25: </Storyboard>
26: </VisualState>
27: <VisualState x:Name="Pressed">
28: <Storyboard>
29: <PointerDownThemeAnimation TargetName="ContentContainer"/>
30: </Storyboard>
31: </VisualState>
32: <VisualState x:Name="PointerOverPressed">
33: <Storyboard>
34: <PointerDownThemeAnimation TargetName="ContentContainer"/>
35: <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PointerOverBorder"/>
36: <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="SelectionBackground">
37: <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ListViewItemSelectedPointerOverBackgroundThemeBrush}"/>
38: </ObjectAnimationUsingKeyFrames>
39: </Storyboard>
40: </VisualState>
41: <VisualState x:Name="Disabled">
42: <Storyboard>
43: <DoubleAnimation Duration="0" To="{StaticResource ListViewItemDisabledThemeOpacity}" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="contentPresenter"/>
44: </Storyboard>
45: </VisualState>
46: </VisualStateGroup>
47: <VisualStateGroup x:Name="FocusStates">
48: <VisualState x:Name="Focused">
49: <Storyboard>
50: <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="FocusVisual"/>
51: </Storyboard>
52: </VisualState>
53: <VisualState x:Name="Unfocused"/>
54: <VisualState x:Name="PointerFocused"/>
55: </VisualStateGroup>
56: <VisualStateGroup x:Name="SelectionHintStates">
57: <VisualStateGroup.Transitions>
58: <VisualTransition GeneratedDuration="0:0:0.65" To="NoSelectionHint"/>
59: </VisualStateGroup.Transitions>
60: <VisualState x:Name="VerticalSelectionHint">
61: <Storyboard>
62: <SwipeHintThemeAnimation ToHorizontalOffset="0" TargetName="SelectionBackground" ToVerticalOffset="15"/>
63: <SwipeHintThemeAnimation ToHorizontalOffset="0" TargetName="ContentBorder" ToVerticalOffset="15"/>
64: <SwipeHintThemeAnimation ToHorizontalOffset="0" TargetName="SelectedCheckMark" ToVerticalOffset="15"/>
65: <DoubleAnimationUsingKeyFrames Duration="0:0:0.500" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="HintGlyph">
66: <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="0.5"/>
67: <DiscreteDoubleKeyFrame KeyTime="0:0:0.500" Value="0"/>
68: </DoubleAnimationUsingKeyFrames>
69: </Storyboard>
70: </VisualState>
71: <VisualState x:Name="HorizontalSelectionHint">
72: <Storyboard>
73: <SwipeHintThemeAnimation ToHorizontalOffset="-23" TargetName="SelectionBackground" ToVerticalOffset="0"/>
74: <SwipeHintThemeAnimation ToHorizontalOffset="-23" TargetName="ContentBorder" ToVerticalOffset="0"/>
75: <SwipeHintThemeAnimation ToHorizontalOffset="-23" TargetName="SelectedCheckMark" ToVerticalOffset="0"/>
76: <DoubleAnimationUsingKeyFrames Duration="0:0:0.500" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="HintGlyph">
77: <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="0.5"/>
78: <DiscreteDoubleKeyFrame KeyTime="0:0:0.500" Value="0"/>
79: </DoubleAnimationUsingKeyFrames>
80: </Storyboard>
81: </VisualState>
82: <VisualState x:Name="NoSelectionHint"/>
83: </VisualStateGroup>
84: <VisualStateGroup x:Name="SelectionStates">
85: <VisualState x:Name="UnselectedSwiping">
86: <Storyboard>
87: <DoubleAnimation Duration="0" To="0.5" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="SelectingGlyph"/>
88: <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="HintGlyphBorder"/>
89: </Storyboard>
90: </VisualState>
91: <VisualState x:Name="Selecting">
92: <Storyboard>
93: <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="SelectionBackground"/>
94: <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="SelectedBorder"/>
95: <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="SelectingGlyph"/>
96: <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="HintGlyphBorder"/>
97: </Storyboard>
98: </VisualState>
99: <VisualState x:Name="Selected">
100: <Storyboard>
101: <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="SelectionBackground"/>
102: <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="SelectedBorder"/>
103: <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="SelectedCheckMark"/>
104: </Storyboard>
105: </VisualState>
106: <VisualState x:Name="SelectedSwiping">
107: <Storyboard>
108: <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="SelectionBackground"/>
109: <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="SelectedBorder"/>
110: <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="SelectedCheckMark"/>
111: </Storyboard>
112: </VisualState>
113: <VisualState x:Name="Unselecting">
114: <Storyboard>
115: <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="HintGlyphBorder"/>
116: </Storyboard>
117: </VisualState>
118: <VisualState x:Name="Unselected">
119: <Storyboard>
120: <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="HintGlyphBorder"/>
121: </Storyboard>
122: </VisualState>
123: <VisualState x:Name="SelectedUnfocused">
124: <Storyboard>
125: <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="SelectionBackground"/>
126: <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="SelectedBorder"/>
127: <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="SelectedCheckMark"/>
128: </Storyboard>
129: </VisualState>
130: </VisualStateGroup>
131: <VisualStateGroup x:Name="DragStates">
132: <VisualStateGroup.Transitions>
133: <VisualTransition GeneratedDuration="0:0:0.2" To="NotDragging"/>
134: </VisualStateGroup.Transitions>
135: <VisualState x:Name="NotDragging"/>
136: <VisualState x:Name="Dragging">
137: <Storyboard>
138: <DoubleAnimation Duration="0" To="{StaticResource ListViewItemDragThemeOpacity}" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="InnerDragContent"/>
139: <DragItemThemeAnimation TargetName="InnerDragContent"/>
140: <FadeOutThemeAnimation TargetName="SelectedCheckMarkOuter"/>
141: <FadeOutThemeAnimation TargetName="SelectedBorder"/>
142: </Storyboard>
143: </VisualState>
144: <VisualState x:Name="DraggingTarget">
145: <Storyboard>
146: <DropTargetItemThemeAnimation TargetName="OuterContainer"/>
147: </Storyboard>
148: </VisualState>
149: <VisualState x:Name="MultipleDraggingPrimary">
150: <Storyboard>
151: <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="MultiArrangeOverlayBackground"/>
152: <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="MultiArrangeOverlayText"/>
153: <DoubleAnimation Duration="0" To="{StaticResource ListViewItemDragThemeOpacity}" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ContentBorder"/>
154: <FadeInThemeAnimation TargetName="MultiArrangeOverlayBackground"/>
155: <FadeInThemeAnimation TargetName="MultiArrangeOverlayText"/>
156: <DragItemThemeAnimation TargetName="ContentBorder"/>
157: <FadeOutThemeAnimation TargetName="SelectionBackground"/>
158: <FadeOutThemeAnimation TargetName="SelectedCheckMarkOuter"/>
159: <FadeOutThemeAnimation TargetName="SelectedBorder"/>
160: <FadeOutThemeAnimation TargetName="PointerOverBorder"/>
161: </Storyboard>
162: </VisualState>
163: <VisualState x:Name="MultipleDraggingSecondary">
164: <Storyboard>
165: <FadeOutThemeAnimation TargetName="ContentContainer"/>
166: </Storyboard>
167: </VisualState>
168: </VisualStateGroup>
169: <VisualStateGroup x:Name="ReorderHintStates">
170: <VisualStateGroup.Transitions>
171: <VisualTransition GeneratedDuration="0:0:0.2" To="NoReorderHint"/>
172: </VisualStateGroup.Transitions>
173: <VisualState x:Name="NoReorderHint"/>
174: <VisualState x:Name="BottomReorderHint">
175: <Storyboard>
176: <DragOverThemeAnimation Direction="Bottom" ToOffset="{StaticResource ListViewItemReorderHintThemeOffset}" TargetName="ReorderHintContent"/>
177: </Storyboard>
178: </VisualState>
179: <VisualState x:Name="TopReorderHint">
180: <Storyboard>
181: <DragOverThemeAnimation Direction="Top" ToOffset="{StaticResource ListViewItemReorderHintThemeOffset}" TargetName="ReorderHintContent"/>
182: </Storyboard>
183: </VisualState>
184: <VisualState x:Name="RightReorderHint">
185: <Storyboard>
186: <DragOverThemeAnimation Direction="Right" ToOffset="{StaticResource ListViewItemReorderHintThemeOffset}" TargetName="ReorderHintContent"/>
187: </Storyboard>
188: </VisualState>
189: <VisualState x:Name="LeftReorderHint">
190: <Storyboard>
191: <DragOverThemeAnimation Direction="Left" ToOffset="{StaticResource ListViewItemReorderHintThemeOffset}" TargetName="ReorderHintContent"/>
192: </Storyboard>
193: </VisualState>
194: </VisualStateGroup>
195: <VisualStateGroup x:Name="DataVirtualizationStates">
196: <VisualState x:Name="DataAvailable"/>
197: <VisualState x:Name="DataPlaceholder">
198: <Storyboard>
199: <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="PlaceholderTextBlock">
200: <DiscreteObjectKeyFrame KeyTime="0">
201: <DiscreteObjectKeyFrame.Value>
202: <Visibility>Visible</Visibility>
203: </DiscreteObjectKeyFrame.Value>
204: </DiscreteObjectKeyFrame>
205: </ObjectAnimationUsingKeyFrames>
206: <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="PlaceholderRect">
207: <DiscreteObjectKeyFrame KeyTime="0">
208: <DiscreteObjectKeyFrame.Value>
209: <Visibility>Visible</Visibility>
210: </DiscreteObjectKeyFrame.Value>
211: </DiscreteObjectKeyFrame>
212: </ObjectAnimationUsingKeyFrames>
213: </Storyboard>
214: </VisualState>
215: </VisualStateGroup>
216: </VisualStateManager.VisualStateGroups>
217: <Grid x:Name="ReorderHintContent" Background="Transparent">
218: <Path x:Name="SelectingGlyph" Data="F1 M133.1,17.9 L137.2,13.2 L144.6,19.6 L156.4,5.8 L161.2,9.9 L145.6,28.4 z" Fill="{StaticResource ListViewItemCheckSelectingThemeBrush}" FlowDirection="LeftToRight" HorizontalAlignment="Right" Height="13" Margin="0,9.5,9.5,0" Opacity="0" Stretch="Fill" VerticalAlignment="Top" Width="15"/>
219: <Border x:Name="ContentContainer">
220: <Grid x:Name="InnerDragContent">
221: <Border x:Name="HintGlyphBorder" HorizontalAlignment="Right" Height="40" Margin="4" Opacity="0" VerticalAlignment="Top" Width="40">
222: <Path x:Name="HintGlyph" Data="F1 M133.1,17.9 L137.2,13.2 L144.6,19.6 L156.4,5.8 L161.2,9.9 L145.6,28.4 z" Fill="{StaticResource ListViewItemCheckHintThemeBrush}" FlowDirection="LeftToRight" HorizontalAlignment="Right" Height="13" Margin="0,5.5,5.5,0" Opacity="0" Stretch="Fill" VerticalAlignment="Top" Width="15"/>
223: </Border>
224: <Rectangle x:Name="PointerOverBorder" Fill="{StaticResource ListViewItemPointerOverBackgroundThemeBrush}" IsHitTestVisible="False" Margin="1" Opacity="0"/>
225: <Rectangle x:Name="FocusVisual" IsHitTestVisible="False" Opacity="0" Stroke="{StaticResource ListViewItemFocusBorderThemeBrush}" StrokeThickness="2"/>
226: <Rectangle x:Name="SelectionBackground" Fill="{StaticResource ListViewItemSelectedBackgroundThemeBrush}" Margin="4" Opacity="0"/>
227: <Border x:Name="ContentBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Margin="4">
228: <Grid>
229: <ContentPresenter x:Name="contentPresenter" ContentTransitions="{TemplateBinding ContentTransitions}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
230: <TextBlock x:Name="PlaceholderTextBlock" Foreground="{x:Null}" IsHitTestVisible="False" Margin="{TemplateBinding Padding}" Text="Xg" Visibility="Collapsed"/>
231: <Rectangle x:Name="PlaceholderRect" Fill="{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}" IsHitTestVisible="False" Visibility="Collapsed"/>
232: <Rectangle x:Name="SelectedBorder" IsHitTestVisible="False" Opacity="0" Stroke="#FFFF8000" StrokeThickness="{StaticResource GridViewItemSelectedBorderThemeThickness}"/>
233: <Rectangle x:Name="MultiArrangeOverlayBackground" Fill="{StaticResource ListViewItemDragBackgroundThemeBrush}" IsHitTestVisible="False" Opacity="0"/>
234: </Grid>
235: </Border>
236: <Border x:Name="SelectedCheckMarkOuter" HorizontalAlignment="Right" IsHitTestVisible="False" Margin="4" Padding="{TemplateBinding BorderThickness}" VerticalAlignment="Top">
237: <Grid x:Name="SelectedCheckMark" Height="40" Opacity="0" Width="40">
238: <Path x:Name="SelectedEarmark" Data="M0,0 L40,0 L40,40 z" Fill="#FFFF8000" Stretch="Fill"/>
239: <Path Data="F1 M133.1,17.9 L137.2,13.2 L144.6,19.6 L156.4,5.8 L161.2,9.9 L145.6,28.4 z" Fill="{StaticResource ListViewItemCheckThemeBrush}" FlowDirection="LeftToRight" HorizontalAlignment="Right" Height="13" Margin="0,5.5,5.5,0" Stretch="Fill" VerticalAlignment="Top" Width="15"/>
240: </Grid>
241: </Border>
242: <TextBlock x:Name="MultiArrangeOverlayText" Foreground="{StaticResource ListViewItemDragForegroundThemeBrush}" FontSize="26.667" FontFamily="{StaticResource ContentControlThemeFontFamily}" IsHitTestVisible="False" Margin="18,9,0,0" Opacity="0" TextWrapping="Wrap" Text="{Binding TemplateSettings.DragItemsCount, RelativeSource={RelativeSource Mode=TemplatedParent}}" TextTrimming="WordEllipsis"/>
243: </Grid>
244: </Border>
245: </Grid>
246: </Border>
247: </ControlTemplate>
248: </Setter.Value>
249: </Setter>
250: /Style>