1: <common:LayoutAwarePage
2: x:Name="pageRoot"
3: x:Class="SilverLightShowDemo.SLShowArticleSearch"
4: DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"
5: IsTabStop="false"
6: xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
7: xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
8: xmlns:local="using:SilverLightShowDemo"
9: xmlns:common="using:SilverLightShowDemo.Common"
10: xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
11: xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
12: mc:Ignorable="d"
13: d:ExtensionType="Search">
14:
15: <Page.Resources>
16:
17: <!-- Collection of grouped Articles displayed by this page -->
18: <CollectionViewSource
19: x:Name="groupedItemsViewSource"
20: Source="{Binding GroupedArticles}"
21: IsSourceGrouped="true"
22: ItemsPath="ArticleCollection"/>
23:
24: </Page.Resources>
25:
26: <Grid Style="{StaticResource SLShowDemoGridLayoutRootStyle}">
27: <Grid.RowDefinitions>
28: <RowDefinition Height="140"/>
29: <RowDefinition Height="*"/>
30: <RowDefinition Height="100"/>
31: </Grid.RowDefinitions>
32:
33: <!-- Logo Area -->
34: <Grid Grid.Row="0">
35: <StackPanel Orientation="Horizontal">
36: <Button x:Name="backButton" Margin="40, 0, 25, 0" Click="backButton_Click">
37: <Button.Template>
38: <ControlTemplate>
39: <StackPanel Orientation="Vertical">
40: <Image x:Name="backIcon" Source="/Assets/BackArrow.png" Height="50" Width="50" />
41: </StackPanel>
42: </ControlTemplate>
43: </Button.Template>
44: </Button>
45: <Image x:Name="Logo" Source="/SilverlightShowLogo.png" Width="195" Height="90" Margin="30, 30, -80, 0" VerticalAlignment="Center"/>
46: <TextBlock x:Name="pageTitle" Text="{StaticResource AppName}" Style="{StaticResource SLShowPageHeaderTextStyle}" VerticalAlignment="Center" Margin="0"/>
47: </StackPanel>
48: </Grid>
49:
50: <Grid x:Name="mainSearchResultArea" Grid.Row="1">
51:
52: <Grid x:Name="searchResultsPanel">
53: <Grid.RowDefinitions>
54: <RowDefinition Height="Auto"/>
55: <RowDefinition Height="*"/>
56: </Grid.RowDefinitions>
57:
58: <StackPanel Orientation="Horizontal" Margin="180,20,25,50" x:Name="searchFilters">
59: <TextBlock Text="Article Name:" Style="{StaticResource AppWideMediumTextStyle}"/>
60: <TextBox x:Name="articleNameTextBox" Width="200" Margin="20,0,0,0" TextChanged="articleNameTextBox_TextChanged"/>
61: <TextBlock Text="Publish Date:" Style="{StaticResource AppWideMediumTextStyle}" Margin="40,0,0,0"/>
62: <ComboBox x:Name="publishDateDropdown" Margin="20,0,0,0" Width="150" SelectionChanged="publishDateDropdown_SelectionChanged" >
63: <ComboBoxItem Content="All" IsSelected="True"/>
64: <ComboBoxItem Content="Today"/>
65: <ComboBoxItem Content="Yesterday"/>
66: <ComboBoxItem Content="Day before Yesterday"/>
67: </ComboBox>
68: </StackPanel>
69:
70: <!-- Horizontal scrolling grid used in most view states -->
71: <ScrollViewer
72: x:Name="itemGridScrollViewer"
73: AutomationProperties.AutomationId="ItemGridScrollViewer"
74: AutomationProperties.Name="Search Results"
75: Grid.Row="1"
76: Margin="0,-3,0,0"
77: Style="{StaticResource HorizontalScrollViewerStyle}">
78:
79: <GridView
80: x:Name="itemGridView"
81: AutomationProperties.AutomationId="ItemGridView"
82: AutomationProperties.Name="Grouped Items"
83: Margin="170,0,100,46"
84: ItemsSource="{Binding Source={StaticResource groupedItemsViewSource}}"
85: ItemTemplate="{StaticResource SLShow250x100ArticleTemplate}">
86:
87: <GridView.ItemsPanel>
88: <ItemsPanelTemplate>
89: <VirtualizingStackPanel Orientation="Horizontal"/>
90: </ItemsPanelTemplate>
91: </GridView.ItemsPanel>
92: <GridView.GroupStyle>
93: <GroupStyle>
94: <GroupStyle.HeaderTemplate>
95: <DataTemplate>
96: <Grid Margin="1,0,0,6">
97: <StackPanel Orientation="Horizontal">
98: <Button AutomationProperties.Name="Group Title" Content="{Binding SLShowArticleGroupName}" Style="{StaticResource SLShowTextButtonStyle}"/>
99: <TextBlock Text="-" Style="{StaticResource SubheaderTextStyle}" VerticalAlignment="Top" Margin="5,0,5,0"/>
100: <TextBlock Text="{Binding SLShowArticleGroupCount}" Style="{StaticResource SubheaderTextStyle}" VerticalAlignment="Top"/>
101: </StackPanel>
102: </Grid>
103: </DataTemplate>
104: </GroupStyle.HeaderTemplate>
105: <GroupStyle.Panel>
106: <ItemsPanelTemplate>
107: <VariableSizedWrapGrid Orientation="Vertical" Margin="0,0,100,0"/>
108: </ItemsPanelTemplate>
109: </GroupStyle.Panel>
110: </GroupStyle>
111: </GridView.GroupStyle>
112: </GridView>
113:
114: </ScrollViewer>
115:
116: <!-- Vertical scrolling list only used when snapped -->
117: <ScrollViewer
118: x:Name="itemListScrollViewer"
119: AutomationProperties.AutomationId="ItemListScrollViewer"
120: Grid.Row="1"
121: Visibility="Collapsed"
122: Style="{StaticResource VerticalScrollViewerStyle}">
123:
124: <ListView
125: x:Name="itemListView"
126: AutomationProperties.AutomationId="ItemListView"
127: AutomationProperties.Name="Grouped Items"
128: Margin="10,-10,0,60"
129: ItemsSource="{Binding Source={StaticResource groupedItemsViewSource}}"
130: ItemTemplate="{StaticResource SLShowSnappedArticleTemplate}">
131:
132: <ListView.GroupStyle>
133: <GroupStyle>
134: <GroupStyle.HeaderTemplate>
135: <DataTemplate>
136: <Grid Margin="7,7,0,0">
137: <Button AutomationProperties.Name="Group Title" Content="{Binding SLShowArticleGroupName}" Style="{StaticResource SLShowTextButtonStyle}"/>
138: </Grid>
139: </DataTemplate>
140: </GroupStyle.HeaderTemplate>
141: </GroupStyle>
142: </ListView.GroupStyle>
143: </ListView>
144: </ScrollViewer>
145:
146: </Grid>
147:
148: </Grid>
149:
150:
151: <TextBlock
152: x:Name="noResultsTextBlock"
153: Grid.Row="1"
154: Margin="220,100,0,0"
155: Visibility="Collapsed"
156: Style="{StaticResource SubheaderTextStyle}"
157: Text="No results match your search." />
158:
159: <VisualStateManager.VisualStateGroups>
160: <!-- Visual states reflect the page's view state -->
161: <VisualStateGroup x:Name = "PageStates">
162: <VisualState x:Name="FullScreenLandscape"/>
163: <VisualState x:Name="Filled"/>
164:
165: <VisualState x:Name="Snapped">
166: <Storyboard>
167: <ObjectAnimationUsingKeyFrames Storyboard.TargetName="itemListScrollViewer" Storyboard.TargetProperty="Visibility">
168: <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
169: </ObjectAnimationUsingKeyFrames>
170: <ObjectAnimationUsingKeyFrames Storyboard.TargetName="itemGridScrollViewer" Storyboard.TargetProperty="Visibility">
171: <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
172: </ObjectAnimationUsingKeyFrames>
173: <ObjectAnimationUsingKeyFrames Storyboard.TargetName="searchFilters" Storyboard.TargetProperty="Visibility">
174: <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
175: </ObjectAnimationUsingKeyFrames>
176: </Storyboard>
177: </VisualState>
178: </VisualStateGroup>
179:
180: <VisualStateGroup x:Name = "ResultStates">
181: <VisualState x:Name="ResultsFound" />
182: <!-- When there are no results, the results panel is replaced with an informational TextBlock -->
183: <VisualState x:Name="NoResultsFound">
184: <Storyboard>
185: <ObjectAnimationUsingKeyFrames Storyboard.TargetName="itemGridScrollViewer" Storyboard.TargetProperty="Visibility">
186: <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
187: </ObjectAnimationUsingKeyFrames>
188: <ObjectAnimationUsingKeyFrames Storyboard.TargetName="itemListScrollViewer" Storyboard.TargetProperty="Visibility">
189: <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
190: </ObjectAnimationUsingKeyFrames>
191: <ObjectAnimationUsingKeyFrames Storyboard.TargetName="noResultsTextBlock" Storyboard.TargetProperty="Visibility">
192: <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
193: </ObjectAnimationUsingKeyFrames>
194: </Storyboard>
195: </VisualState>
196: </VisualStateGroup>
197:
198: </VisualStateManager.VisualStateGroups>
199: </Grid>
200:
201: mmon:LayoutAwarePage>