-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainPage.xaml
28 lines (26 loc) · 1.24 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
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:hackerNews="clr-namespace:HackerNews"
x:Class="HackerNews.MainPage"
x:DataType="hackerNews:NewsViewModel">
<CollectionView x:Name="NewsCollectionView"
ItemsSource="{Binding TopStoryCollection}"
SelectionMode="Single"
SelectionChanged="NewsCollectionView_OnSelectionChanged">
<CollectionView.ItemTemplate>
<DataTemplate x:DataType="hackerNews:StoryModel">
<Frame Padding="10" Margin="5" BorderColor="LightGray">
<StackLayout>
<Label Text="{Binding Title}"
FontSize="18"
FontAttributes="Bold" />
<Label Text="{Binding CreatedAt, StringFormat='{0:MMM dd, yyyy h:mm tt}'}"
FontSize="14"
TextColor="Gray" />
</StackLayout>
</Frame>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</ContentPage>