/
BlogPosts.xaml
74 lines (69 loc) · 4.12 KB
/
BlogPosts.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
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="CryptoNews.Views.BlogPosts"
Title="Latest News"
BackgroundColor="#e8eaed">
<ContentPage.Content>
<StackLayout>
<ActivityIndicator IsEnabled="{Binding IsBusy}"
IsRunning="{Binding IsBusy}"
IsVisible="{Binding IsBusy}"
VerticalOptions="Center"
HorizontalOptions="Center"/>
<Label Text="Fetching News...This might take a while" FontSize="Small"
IsEnabled="{Binding IsBusy}"
IsVisible="{Binding IsBusy}"
VerticalOptions="Center"
HorizontalOptions="Center"/>
<SearchBar TextChanged="SearchBar_TextChanged"></SearchBar>
<Grid VerticalOptions="FillAndExpand">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<ListView x:Name="BlogPostsListView"
ItemsSource="{Binding BlogPosts}"
ItemSelected="OnSinglePostSelected"
IsPullToRefreshEnabled="True"
RefreshCommand="{Binding RefreshCommand}"
IsRefreshing="{Binding IsRefreshing}"
HasUnevenRows="True"
VerticalOptions="FillAndExpand"
SeparatorVisibility="None">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.ContextActions>
<MenuItem Clicked="OnFavouriteClicked" CommandParameter="{Binding .}" Text="Add To Favourite" />
<MenuItem Clicked="OnShareClicked" CommandParameter="{Binding .}" Text="Share Post" />
</ViewCell.ContextActions>
<ViewCell.View>
<Frame HasShadow="True" Margin="4">
<StackLayout>
<Label Text="{Binding Title}" FontSize="Large" TextColor="Black"/>
<Label Text="{Binding BlogWebsiteName}" FontSize="Small" TextColor="Green"/>
<Label Text="{Binding PrettyDate}" FontSize="Small" FontAttributes="Italic" TextColor="PaleVioletRed"/>
<Image Margin="0">
<Image.Source>
<UriImageSource Uri="{Binding FeaturedImage}"
CacheValidity="21"
CachingEnabled="true"/>
</Image.Source>
</Image>
<Label Text="{Binding Excerpt, StringFormat='{0} ...'}" TextColor="Black" FontSize="Medium"/>
<!--<WebView>
<WebView.Source>
<HtmlWebViewSource Html="{Binding Excerpt, StringFormat='{0} ...'}" />
</WebView.Source>
</WebView>-->
</StackLayout>
</Frame>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
</StackLayout>
</ContentPage.Content>
</ContentPage>