Skip to content

Commit bdff8d9

Browse files
authored
Added demo and updated README (#147)
1 parent 6b21e2e commit bdff8d9

File tree

3 files changed

+44
-2
lines changed

3 files changed

+44
-2
lines changed

sessions/Season-06/0602/src/MonkeyFinder/AppShell.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
44
x:Class="MonkeyFinder.AppShell"
55
xmlns:view="clr-namespace:MonkeyFinder.View"
6+
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
67
FlyoutBehavior="Disabled">
78

89

sessions/Season-06/0602/src/MonkeyFinder/Model/Monkey.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,11 @@
22

33
public class Monkey
44
{
5-
5+
public string Name { get; set; }
6+
public string Location { get; set; }
7+
public string Details { get; set; }
8+
public string Image { get; set; }
9+
public int Population { get; set; }
10+
public float Latitude { get; set; }
11+
public float Longitude { get; set; }
612
}
Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,42 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
33
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4+
xmlns:model="clr-namespace:MonkeyFinder.Model"
45
x:Class="MonkeyFinder.View.MainPage">
56

6-
7+
<CollectionView>
8+
<CollectionView.ItemsSource>
9+
<x:Array Type="{x:Type model:Monkey}">
10+
<model:Monkey
11+
Name="Baboon"
12+
Image="https://raw.githubusercontent.com/jamesmontemagno/app-monkeys/master/baboon.jpg"
13+
Location="Africa and Asia" />
14+
<model:Monkey
15+
Name="Capuchin Monkey"
16+
Image="https://raw.githubusercontent.com/jamesmontemagno/app-monkeys/master/capuchin.jpg"
17+
Location="Central and South America" />
18+
<model:Monkey
19+
Name="Red-shanked douc"
20+
Image="https://raw.githubusercontent.com/jamesmontemagno/app-monkeys/master/douc.jpg"
21+
Location="Vietnam" />
22+
</x:Array>
23+
</CollectionView.ItemsSource>
24+
<CollectionView.ItemTemplate>
25+
<DataTemplate x:DataType="model:Monkey">
26+
<HorizontalStackLayout Padding="10">
27+
<Image
28+
Aspect="AspectFill"
29+
HeightRequest="100"
30+
Source="{Binding Image}"
31+
WidthRequest="100" />
32+
<VerticalStackLayout VerticalOptions="Center">
33+
<Label Text="{Binding Name}" FontSize="24" TextColor="Gray"/>
34+
<Label Text="{Binding Location}" FontSize="18" TextColor="Gray"/>
35+
</VerticalStackLayout>
36+
</HorizontalStackLayout>
37+
</DataTemplate>
38+
</CollectionView.ItemTemplate>
39+
</CollectionView>
40+
741
</ContentPage>
42+

0 commit comments

Comments
 (0)