forked from microsoft/Windows-appsample-photo-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainPage.xaml
160 lines (135 loc) · 7.09 KB
/
MainPage.xaml
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
<!--
Copyright (c) Microsoft Corporation. All rights reserved.
The MIT License (MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<Page
x:Class="PhotoEditor.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:PhotoEditor"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
NavigationCacheMode="Enabled"
RequestedTheme="Dark">
<Page.Resources>
<!-- Margins for grid items -->
<x:Int32 x:Key="LargeItemMarginValue">4</x:Int32>
<Thickness x:Key="LargeItemMargin">4</Thickness>
<x:Int32 x:Key="DesktopWindowSidePaddingValue">16</x:Int32>
<ItemsPanelTemplate x:Key="ImageGridView_ItemsPanelTemplate">
<ItemsWrapGrid Orientation="Horizontal"
HorizontalAlignment="Center" />
</ItemsPanelTemplate>
<DataTemplate x:Key="ImageGridView_DefaultItemTemplate"
x:DataType="local:Photo">
<Image x:Name="ItemImage"
Stretch="Uniform"
Opacity="0"
Height="200"
Width="300"
Margin="{StaticResource LargeItemMargin}">
<ToolTipService.ToolTip>
<ToolTip Content="{x:Bind ImageTitle, Mode=OneWay}"/>
</ToolTipService.ToolTip>
</Image>
</DataTemplate>
<Style x:Key="ImageGridView_DefaultItemContainerStyle"
TargetType="GridViewItem">
<Setter Property="Margin"
Value="{StaticResource LargeItemMargin}" />
</Style>
<DataTemplate x:Key="ImageGridView_MobileItemTemplate"
x:DataType="local:Photo">
<Grid Height="100"
Width="100">
<Image x:Name="ItemImage"
Stretch="UniformToFill"
Opacity="0">
<ToolTipService.ToolTip>
<ToolTip x:Name="tooltip">
<StackPanel Orientation="Vertical"
Grid.Row="1">
<TextBlock Text="{x:Bind ImageTitle, Mode=OneWay}"
HorizontalAlignment="Center"
Style="{StaticResource SubtitleTextBlockStyle}" />
<StackPanel Orientation="Horizontal"
HorizontalAlignment="Center">
<TextBlock Text="{x:Bind ImageFileType}"
HorizontalAlignment="Center"
Style="{StaticResource CaptionTextBlockStyle}" />
<TextBlock Text="{x:Bind ImageDimensions}"
HorizontalAlignment="Center"
Style="{StaticResource CaptionTextBlockStyle}"
Margin="8,0,0,0" />
</StackPanel>
</StackPanel>
</ToolTip>
</ToolTipService.ToolTip>
</Image>
</Grid>
</DataTemplate>
<Style x:Key="ImageGridView_MobileItemContainerStyle"
TargetType="GridViewItem" />
</Page.Resources>
<RelativePanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<TextBlock x:Name="TitleTextBlock"
Text="Collection"
Style="{StaticResource TitleTextBlockStyle}"
Margin="24,0,0,24" />
<CommandBar x:Name="MainCommandBar"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
RelativePanel.AlignRightWithPanel="True"
OverflowButtonVisibility="Collapsed"
DefaultLabelPosition="Right">
</CommandBar>
<ProgressBar x:Name="LoadProgressIndicator" Margin="0,-10,0,0"
IsIndeterminate="True" Visibility="Visible"
RelativePanel.AlignLeftWithPanel="True"
RelativePanel.AlignRightWithPanel="True"
RelativePanel.Below="TitleTextBlock"/>
<Grid RelativePanel.AlignLeftWithPanel="True"
RelativePanel.AlignRightWithPanel="True"
RelativePanel.Below="LoadProgressIndicator">
<ParallaxView x:Name="ParaView" VerticalShift="50">
<!--Background element-->
<Image x:Name="BackgroundImage" Source="Assets/bg1.png"
Stretch="UniformToFill"/>
</ParallaxView>
<!--Foreground element-->
<ScrollViewer x:Name="ForegroundElement">
<GridView x:Name="ImageGridView"
Margin="0,0,0,8"
ItemClick="ImageGridView_ItemClick"
IsItemClickEnabled="True"
ItemsSource="{x:Bind Photos, Mode=OneWay}"
RelativePanel.AlignLeftWithPanel="True"
RelativePanel.AlignRightWithPanel="True"
RelativePanel.Below="TitleTextBlock"
Loaded="{x:Bind StartConnectedAnimationForBackNavigation}"
ItemsPanel="{StaticResource ImageGridView_ItemsPanelTemplate}"
ItemTemplate="{StaticResource ImageGridView_DefaultItemTemplate}"
ContainerContentChanging="OnContainerContentChanging">
</GridView>
</ScrollViewer>
<TextBlock x:Name="NoPicsText" Text="Sorry, we couldn't find any images in your Pictures library. Please add some pictures to your library and relaunch the app."
HorizontalAlignment="Center" Margin="0,100,0,0"
Foreground="White" Visibility="Collapsed"/>
</Grid>
</RelativePanel>
</Page>