File tree Expand file tree Collapse file tree 3 files changed +44
-2
lines changed
sessions/Season-06/0602/src/MonkeyFinder Expand file tree Collapse file tree 3 files changed +44
-2
lines changed Original file line number Diff line number Diff line change 3
3
xmlns : x =" http://schemas.microsoft.com/winfx/2009/xaml"
4
4
x : Class =" MonkeyFinder.AppShell"
5
5
xmlns : view =" clr-namespace:MonkeyFinder.View"
6
+ xmlns : toolkit =" http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
6
7
FlyoutBehavior =" Disabled" >
7
8
8
9
Original file line number Diff line number Diff line change 2
2
3
3
public class Monkey
4
4
{
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 ; }
6
12
}
Original file line number Diff line number Diff line change 1
1
<?xml version =" 1.0" encoding =" utf-8" ?>
2
2
<ContentPage xmlns =" http://schemas.microsoft.com/dotnet/2021/maui"
3
3
xmlns : x =" http://schemas.microsoft.com/winfx/2009/xaml"
4
+ xmlns : model =" clr-namespace:MonkeyFinder.Model"
4
5
x : Class =" MonkeyFinder.View.MainPage" >
5
6
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
+
7
41
</ContentPage >
42
+
You can’t perform that action at this time.
0 commit comments