-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Expand file tree
/
Copy pathSearchResultsPage.xaml
More file actions
152 lines (145 loc) · 7.58 KB
/
Copy pathSearchResultsPage.xaml
File metadata and controls
152 lines (145 loc) · 7.58 KB
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
<Page
x:Name="pageRoot"
x:Class="AppUIBasics.SearchResultsPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:AppUIBasics"
xmlns:common="using:AppUIBasics.Common"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:data="using:AppUIBasics.Data"
mc:Ignorable="d"
d:ExtensionType="Search">
<!--
This grid acts as a root panel for the page that defines two rows:
* Row 0 contains the back button and page title
* Row 1 contains the rest of the page layout
-->
<RelativePanel Background="{ThemeResource ControlPageBackgroundBrush}">
<RelativePanel.ChildrenTransitions>
<TransitionCollection>
<EntranceThemeTransition/>
</TransitionCollection>
</RelativePanel.ChildrenTransitions>
<!-- Back button and page title -->
<local:PageHeader x:Name="header" Title="Search" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" />
<!--
The body of the page in most view states uses an items controls to create multiple radio buttons
for filtering above a horizontal scrolling grid of search results
-->
<ScrollViewer x:Name="filterItemContainer"
HorizontalScrollMode="Auto" HorizontalScrollBarVisibility="Auto"
VerticalScrollMode="Disabled" VerticalScrollBarVisibility="Hidden"
RelativePanel.Below="header">
<ItemsControl
x:Name="filtersItemsControl"
Canvas.ZIndex="1"
IsTabStop="False"
ItemsSource="{x:Bind Filters, Mode=OneWay}"
Visibility="{x:Bind ShowFilters, Converter={StaticResource booleanToVisibilityConverter}, Mode=OneWay}" >
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate x:DataType="local:Filter">
<Border>
<RadioButton
Margin="0,0,30,0"
GroupName="Filters"
IsChecked="{x:Bind Active, Mode=TwoWay}"
Checked="Filter_Checked"
Style="{StaticResource TextBlockButtonStyle}">
<TextBlock Text="{x:Bind Description}" TextWrapping="NoWrap"
Margin="3,-7,3,10" Style="{StaticResource SubtitleTextBlockStyle}" />
</RadioButton>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
<GridView
x:Name="resultsGridView"
AutomationProperties.AutomationId="ResultsGridView"
AutomationProperties.Name="Search Results"
TabIndex="1"
SelectionMode="None"
IsSwipeEnabled="false"
IsItemClickEnabled="True"
ItemsSource="{x:Bind Results, Mode=OneWay}"
ItemClick="resultsGridView_ItemClick"
RelativePanel.Below="filterItemContainer"
RelativePanel.AlignLeftWithPanel="True"
RelativePanel.AlignRightWithPanel="True">
<GridView.ItemContainerStyle>
<Style TargetType="GridViewItem">
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="Height" Value="110"/>
</Style>
</GridView.ItemContainerStyle>
<GridView.ItemTemplate>
<DataTemplate x:DataType="data:ControlInfoDataItem">
<Grid Margin="5" Width="380">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Border Background="{ThemeResource ListViewItemPlaceholderBackgroundThemeBrush}"
Width="60" Height="60">
<Image Source="{x:Bind ImagePath}" Stretch="Fill"/>
</Border>
<StackPanel Grid.Column="1" Margin="10,0,0,0">
<TextBlock Text="{x:Bind Title}" TextWrapping="Wrap" Style="{StaticResource BaseTextBlockStyle}"/>
<TextBlock Text="{x:Bind Subtitle}" TextWrapping="Wrap" Style="{StaticResource BodyTextBlockStyle}" />
</StackPanel>
</Grid>
</DataTemplate>
</GridView.ItemTemplate>
</GridView>
<TextBlock
x:Name="noResultsTextBlock"
Grid.Row="1"
Visibility="Collapsed"
Style="{StaticResource SubheaderTextBlockStyle}"
Text="No results match your search."
RelativePanel.Below="header"/>
<TextBox x:Name="query" TextChanged="query_TextChanged" RelativePanel.AlignBottomWithPanel="True" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" />
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="ResultStates">
<VisualState x:Name="ResultsFound" />
<!-- When there are no results, the results panel is replaced with an informational TextBlock -->
<VisualState x:Name="NoResultsFound">
<VisualState.Setters>
<Setter Target="resultsGridView.Visibility" Value="Collapsed" />
<Setter Target="noResultsTextBlock.Visibility" Value="Visible" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
<VisualStateGroup>
<VisualState x:Name="WideLayout">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="600" />
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="filterItemsControl.Margin" Value="24,24,24,0" />
<Setter Target="resultsGridView.Margin" Value="24,24,24,35" />
<Setter Target="noResultsTextBlock.Margin" Value="24,24,24,0" />
<Setter Target="query.Visibility" Value="Collapsed" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="NarrowLayout">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="0" />
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="filterItemsControl.Margin" Value="12,12,12,0" />
<Setter Target="filterItemsControl.FontSize" Value="12" />
<Setter Target="resultsGridView.Margin" Value="12,12,12,30" />
<Setter Target="noResultsTextBlock.Margin" Value="12,12,12,0" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</RelativePanel>
</Page>