-
Notifications
You must be signed in to change notification settings - Fork 117
/
Copy pathHeroImageControl.xaml
110 lines (104 loc) · 5.12 KB
/
HeroImageControl.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
<!--
// 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. -->
<UserControl
x:Class="PhotoSharingApp.Universal.Controls.HeroImageControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:PhotoSharingApp.Universal.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="using:PhotoSharingApp.Universal.Controls"
xmlns:valueConverters="using:PhotoSharingApp.Universal.ValueConverters"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="400">
<UserControl.Resources>
<valueConverters:RelativeTimeConverter x:Key="RelativeTimeConverter" />
</UserControl.Resources>
<Grid x:Name="layoutRoot">
<ProgressRing x:Name="progressIndicator" />
<Image Source="{Binding ImageUrl}" Stretch="UniformToFill" VerticalAlignment="Center" x:Name="heroImage" />
<Grid>
<Grid.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#CC000000" Offset="1" />
<GradientStop Offset="0.647" />
</LinearGradientBrush>
</Grid.Background>
</Grid>
<Grid VerticalAlignment="Bottom" Margin="20" x:Name="heroImageDetailsContainer">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Border Padding="1" Margin="0,0,9.5,0">
<controls:UserProfilePictureControl
x:Name="profilePictureControl"
Width="100"
Height="100"
Source="{Binding User.ProfilePictureUrl}" />
</Border>
<Grid Grid.Column="1" VerticalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" Grid.Row="1">
<TextBlock x:Name="caption" Text="{Binding Caption}" FontWeight="Thin" FontSize="30"
Foreground="White" TextTrimming="WordEllipsis" />
</StackPanel>
<TextBlock Foreground="White" Margin="0" Grid.Row="0"
Text="{Binding CreatedAt, Converter={StaticResource RelativeTimeConverter}}" />
</Grid>
</Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup>
<VisualState>
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="900" />
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="heroImageDetailsContainer.Visibility" Value="Collapsed" />
</VisualState.Setters>
</VisualState>
<VisualState>
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="0" />
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="profilePictureEllipse.Width" Value="60" />
<Setter Target="profilePictureEllipse.Height" Value="60" />
<Setter Target="caption.FontSize" Value="20" />
<Setter Target="heroImageDetailsContainer.Visibility" Value="Visible" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</UserControl>