Add project files.
This commit is contained in:
52
MonkeyFinder/View/DetailsPage.xaml
Normal file
52
MonkeyFinder/View/DetailsPage.xaml
Normal file
@ -0,0 +1,52 @@
|
||||
<?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"
|
||||
x:Class="MonkeyFinder.DetailsPage"
|
||||
xmlns:viewmodel="clr-namespace:MonkeyFinder.ViewModel"
|
||||
x:DataType="viewmodel:MonkeyDetailsViewModel"
|
||||
Title="{Binding Monkey.Name}">
|
||||
<ScrollView>
|
||||
<VerticalStackLayout>
|
||||
<Grid ColumnDefinitions="*,Auto,*"
|
||||
RowDefinitions="160,Auto">
|
||||
<BoxView BackgroundColor="{StaticResource Primary}"
|
||||
Grid.ColumnSpan="3"
|
||||
HeightRequest="160"
|
||||
HorizontalOptions="FillAndExpand"/>
|
||||
<Frame Grid.RowSpan="2"
|
||||
Grid.Column="1"
|
||||
HeightRequest="160"
|
||||
WidthRequest="160"
|
||||
CornerRadius="80"
|
||||
HorizontalOptions="Center"
|
||||
IsClippedToBounds="True"
|
||||
Padding="0"
|
||||
Margin="0,80,0,0">
|
||||
<Image Aspect="AspectFill"
|
||||
HeightRequest="160"
|
||||
WidthRequest="160"
|
||||
HorizontalOptions="Center"
|
||||
VerticalOptions="Center"
|
||||
Source="{Binding Monkey.Image}"/>
|
||||
</Frame>
|
||||
|
||||
</Grid>
|
||||
|
||||
<Button Text="Show on Map"
|
||||
Command="{Binding OpenMapCommand}"
|
||||
HorizontalOptions="Center"
|
||||
WidthRequest="200"
|
||||
Margin="8"
|
||||
Style="{StaticResource ButtonOutline}"/>
|
||||
|
||||
<VerticalStackLayout Padding="10" Spacing="10">
|
||||
<Label Text="{Binding Monkey.Details}"
|
||||
Style="{StaticResource MediumLabel}"/>
|
||||
<Label Text="{Binding Monkey.Location, StringFormat='Location: {0}'}"
|
||||
Style="{StaticResource SmallLabel}"/>
|
||||
<Label Text="{Binding Monkey.Population, StringFormat='Population: {0}'}"
|
||||
Style="{StaticResource SmallLabel}"/>
|
||||
</VerticalStackLayout>
|
||||
</VerticalStackLayout>
|
||||
</ScrollView>
|
||||
</ContentPage>
|
||||
15
MonkeyFinder/View/DetailsPage.xaml.cs
Normal file
15
MonkeyFinder/View/DetailsPage.xaml.cs
Normal file
@ -0,0 +1,15 @@
|
||||
namespace MonkeyFinder;
|
||||
|
||||
public partial class DetailsPage : ContentPage
|
||||
{
|
||||
public DetailsPage(MonkeyDetailsViewModel viewModel)
|
||||
{
|
||||
InitializeComponent();
|
||||
BindingContext = viewModel;
|
||||
}
|
||||
|
||||
protected override void OnNavigatedTo(NavigatedToEventArgs args)
|
||||
{
|
||||
base.OnNavigatedTo(args);
|
||||
}
|
||||
}
|
||||
72
MonkeyFinder/View/MainPage.xaml
Normal file
72
MonkeyFinder/View/MainPage.xaml
Normal file
@ -0,0 +1,72 @@
|
||||
<?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:model="clr-namespace:MonkeyFinder.Model"
|
||||
xmlns:viewmodel="clr-namespace:MonkeyFinder.ViewModel"
|
||||
xmlns:ios="clr-namespace:Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific;assembly=Microsoft.Maui.Controls"
|
||||
x:DataType="viewmodel:MonkeysViewModel"
|
||||
Title="{Binding Title}"
|
||||
ios:Page.UseSafeArea="True"
|
||||
x:Class="MonkeyFinder.View.MainPage">
|
||||
<Grid ColumnDefinitions="*,*"
|
||||
ColumnSpacing="5"
|
||||
RowDefinitions="*,Auto">
|
||||
|
||||
<CollectionView BackgroundColor="Transparent"
|
||||
Grid.ColumnSpan="2"
|
||||
ItemsSource="{Binding Monkeys}"
|
||||
SelectionMode="None">
|
||||
<CollectionView.ItemTemplate>
|
||||
<DataTemplate x:DataType="model:Monkey">
|
||||
<Grid Padding="10">
|
||||
<Frame HeightRequest="125"
|
||||
Padding="0"
|
||||
Style="{StaticResource CardView}">
|
||||
<Frame.GestureRecognizers>
|
||||
<TapGestureRecognizer CommandParameter="{Binding .}"
|
||||
Command="{Binding Source={RelativeSource AncestorType={x:Type viewmodel:MonkeysViewModel}}, Path=GoToDetailsCommand}"/>
|
||||
</Frame.GestureRecognizers>
|
||||
<Grid Padding="0"
|
||||
ColumnDefinitions="125,*">
|
||||
<Image Aspect="AspectFill"
|
||||
Source="{Binding Image}"
|
||||
WidthRequest="125"
|
||||
HeightRequest="125"/>
|
||||
<VerticalStackLayout Grid.Column="1"
|
||||
Padding="10"
|
||||
VerticalOptions="Center">
|
||||
<Label Text="{Binding Name}"
|
||||
Style="{StaticResource LargeLabel}"/>
|
||||
<Label Text="{Binding Location}"
|
||||
Style="{StaticResource MediumLabel}"/>
|
||||
</VerticalStackLayout>
|
||||
|
||||
</Grid>
|
||||
</Frame>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</CollectionView.ItemTemplate>
|
||||
</CollectionView>
|
||||
<Button Text="Get Monkeys"
|
||||
Style="{StaticResource ButtonOutline}"
|
||||
Command="{Binding GetMonkeysCommand}"
|
||||
IsEnabled="{Binding IsNotBusy}"
|
||||
Grid.Row="1"
|
||||
Margin="8"/>
|
||||
|
||||
<Button Text="Find closest"
|
||||
Style="{StaticResource ButtonOutline}"
|
||||
Command="{Binding GetClosestMonkeyCommand}"
|
||||
IsEnabled="{Binding IsNotBusy}"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Margin="8"/>
|
||||
<ActivityIndicator IsVisible="{Binding IsBusy}"
|
||||
IsRunning="{Binding IsBusy}"
|
||||
HorizontalOptions="FillAndExpand"
|
||||
VerticalOptions="FillAndExpand"
|
||||
Grid.RowSpan="2"
|
||||
Grid.ColumnSpan="2"/>
|
||||
|
||||
</Grid>
|
||||
</ContentPage>
|
||||
11
MonkeyFinder/View/MainPage.xaml.cs
Normal file
11
MonkeyFinder/View/MainPage.xaml.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace MonkeyFinder.View;
|
||||
|
||||
public partial class MainPage : ContentPage
|
||||
{
|
||||
public MainPage(MonkeysViewModel viewModel)
|
||||
{
|
||||
InitializeComponent();
|
||||
BindingContext = viewModel;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user