-
Notifications
You must be signed in to change notification settings - Fork 109
/
EditFeedsView.xaml
171 lines (154 loc) · 7.91 KB
/
EditFeedsView.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
161
162
163
164
165
166
167
168
169
170
171
<!--
// 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="RssReader.Views.EditFeedsView"
NavigationCacheMode="Required"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:RssReader.Views"
xmlns:common="using:RssReader.Common"
xmlns:controls="using:RssReader.Controls"
xmlns:viewmodels="using:RssReader.ViewModels"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Page.Resources>
<common:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
<DataTemplate x:Key="EditFeedsListItemTemplate"
x:DataType="viewmodels:FeedViewModel">
<Grid>
<TextBlock Text="{x:Bind Name, Mode=OneWay}"
TextWrapping="NoWrap"
Visibility="{x:Bind IsInEdit, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}, ConverterParameter=Reverse}"
Style="{StaticResource BodyTextBlockStyle}" />
<TextBox x:Name="EditTextBox"
Text="{x:Bind Name, Mode=TwoWay}"
LostFocus="EndEdit"
KeyDown="EditTextBox_KeyDown"
Visibility="{x:Bind IsInEdit, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}}" />
</Grid>
</DataTemplate>
</Page.Resources>
<Grid Background="{ThemeResource Background100CloudBrush}">
<!--No-feeds-to-edit content-->
<Grid Visibility="{x:Bind ViewModel.HasNoFeeds, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}}">
<Grid.RowDefinitions>
<RowDefinition Height="96" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!--Instruction content-->
<Grid Background="{ThemeResource Background100PastelLemonBrush}"
HorizontalAlignment="Stretch">
<Image Width="140"
Height="96"
Source="ms-appx:///Assets/icon_noeditfeeds.png"
VerticalAlignment="Center"
HorizontalAlignment="Center" />
</Grid>
<TextBlock Grid.Row="1"
Margin="24,12"
Text="Aw shucks! You have no feeds now."
TextWrapping="Wrap"
Foreground="{ThemeResource Foreground100CrimsonBrush}"
Style="{ThemeResource SubtitleTextBlockStyle}" />
<Rectangle Grid.Row="2"
Margin="24,0.333,24,0"
Height="1"
HorizontalAlignment="Stretch"
VerticalAlignment="Bottom"
Fill="{ThemeResource Border100PaleRoseBrush}" />
<TextBlock Grid.Row="3"
Margin="24,24,24,12"
Text="Go ahead and add a feed or three."
TextWrapping="Wrap"
Foreground="{ThemeResource Foreground100DimGrayBrush}"
Style="{ThemeResource BodyTextBlockStyle}" />
<Button Grid.Row="4"
Margin="24,0"
Width="120"
Content="Add a feed"
Click="{x:Bind AddFeed}"
Style="{StaticResource ButtonStyle2}" />
</Grid>
<!--Normal edit-feeds content-->
<Grid Visibility="{x:Bind ViewModel.HasNoFeeds, Mode=OneWay, ConverterParameter=Reverse, Converter={StaticResource BooleanToVisibilityConverter}}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<controls:PageHeader>
<controls:PageHeader.HeaderContent>
<TextBlock Text="Edit your feeds"
Foreground="{ThemeResource Foreground100CrimsonBrush}"
Style="{ThemeResource SubtitleTextBlockStyle}" />
</controls:PageHeader.HeaderContent>
</controls:PageHeader>
<Rectangle Grid.Row="1"
Margin="24,0"
Height="1"
HorizontalAlignment="Stretch"
Fill="{ThemeResource Border100PaleRoseBrush}" />
<TextBlock x:Name="EditRSSHelp"
Grid.Row="2"
Margin="24,24,24,12"
Text="Personalize your views. You can either change a title or delete a RSS feed. You can even arrange your RSS feeds in any order as you like."
TextWrapping="Wrap"
VerticalAlignment="Top"
Foreground="{ThemeResource Foreground100DimGrayBrush}"
Style="{StaticResource CaptionTextBlockStyle}" />
<ListView x:Name="EditFeedsList"
Grid.Row="3"
Margin="24,12,0,0"
IsMultiSelectCheckBoxEnabled="True"
SelectionMode="Multiple"
CanReorderItems="True"
AllowDrop="True"
IsSwipeEnabled="True"
ItemsSource="{x:Bind ViewModel.Feeds, Mode=OneWay}"
ItemTemplate="{StaticResource EditFeedsListItemTemplate}"
ItemContainerStyle="{StaticResource ListViewItemEditFeed}"
SelectionChanged="{x:Bind SelectionChanged}" />
<CommandBar Grid.Row="4">
<AppBarButton Icon="Add"
Label="Add feed"
Click="{x:Bind AddFeed}"
ToolTipService.ToolTip="Add feed" />
<AppBarButton Icon="Edit"
Label="Rename"
ToolTipService.ToolTip="Edit feed"
Click="{x:Bind EditFeed}"
IsEnabled="{x:Bind CanEdit, Mode=OneWay}" />
<AppBarButton Icon="Delete"
Label="Delete"
Click="{x:Bind DeleteSelectedFeeds}"
ToolTipService.ToolTip="Delete feed" />
</CommandBar>
</Grid>
</Grid>
</Page>