Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
<TargetFrameworkVersion>v9.0</TargetFrameworkVersion>
<AndroidEnableSGenConcurrent>true</AndroidEnableSGenConcurrent>
<AndroidUseAapt2>true</AndroidUseAapt2>
Expand Down Expand Up @@ -96,7 +95,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CarouselViewChallenge\CarouselViewChallenge.csproj">
<Project>{1AD32EAF-CE1F-497F-8598-87F19CDA3D10}</Project>
<Project>{A9F8B9B3-719F-4F40-9044-924E7B921409}</Project>
<Name>CarouselViewChallenge</Name>
</ProjectReference>
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.companyname.carouselviewchallenge">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28" />
<application android:label="CarouselViewChallenge.Android"></application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28" />
<application android:label="CarouselViewChallenge.Android"></application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,14 @@
<BundleResource Include="Resources\xamarin_logo%402x.png" />
<BundleResource Include="Resources\xamarin_logo%403x.png" />
<InterfaceDefinition Include="Resources\LaunchScreen.storyboard" />
<BundleResource Include="Resources\Asian-Paradise-Flycatcher.jpg" />
<BundleResource Include="Resources\Himalayan-Monal.jpg" />
<BundleResource Include="Resources\Indian-Peafowl.jpg" />
<BundleResource Include="Resources\Mrs.-Gould’s-Sunbird.jpg" />
<BundleResource Include="Resources\Oriental-Dwarf-Kingfisher.jpg" />
<BundleResource Include="Resources\Red-Headed-Trogon.jpg" />
<BundleResource Include="Resources\Sarus-Crane.jpg" />
<BundleResource Include="Resources\Satyr-Tragopan.jpg" />
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
Expand All @@ -135,7 +143,7 @@
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
<ItemGroup>
<ProjectReference Include="..\CarouselViewChallenge\CarouselViewChallenge.csproj">
<Project>{1AD32EAF-CE1F-497F-8598-87F19CDA3D10}</Project>
<Project>{A9F8B9B3-719F-4F40-9044-924E7B921409}</Project>
<Name>CarouselViewChallenge</Name>
</ProjectReference>
</ItemGroup>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions CarouselViewChallenge/CarouselViewChallenge/Models/BirdsModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;
using Xamarin.Forms;

namespace CarouselViewChallenge.Models
{
public class BirdsModel
{
public string Title { get; set; }
public ImageSource ImagePath { get; set; }
public string Description { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using CarouselViewChallenge.Models;
namespace CarouselViewChallenge.ViewModels
{
public class CarouselPageViewModel: INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;

private ObservableCollection<BirdsModel> _birds;
private ObservableCollection<string> _numbers;
private string _pageTitle;
public CarouselPageViewModel()
{
_pageTitle = "CarouselViewChallege";
_birds = new ObservableCollection<BirdsModel>();
_birds.Add(new BirdsModel { Title = "Asian Paradise Flycatcher", ImagePath = "Asian-Paradise-Flycatcher.jpg" });
_birds.Add(new BirdsModel { Title = "Sarus Crane", ImagePath = "Sarus-Crane.jpg" });
_birds.Add(new BirdsModel { Title = "Himalayan Monal", ImagePath = "Himalayan-Monal.jpg" });
_birds.Add(new BirdsModel { Title = "Indian Peafowl", ImagePath = "Indian-Peafowl.jpg" });
_birds.Add(new BirdsModel { Title = "Mrs. Gould’s Sunbird", ImagePath = "Mrs.-Gould’s-Sunbird.jpg" });
_birds.Add(new BirdsModel { Title = "Oriental Dwarf Kingfisher", ImagePath = "Oriental-Dwarf-Kingfisher.jpg" });
_birds.Add(new BirdsModel { Title = "Red Headed Trogon", ImagePath = "Red-Headed-Trogon.jpg" });


_numbers = new ObservableCollection<string>();
_numbers.Add("One");
_numbers.Add("Two");
_numbers.Add("Three");
_numbers.Add("Four");
_numbers.Add("Five");
_numbers.Add("Six");
_numbers.Add("Seven");
_numbers.Add("Eight");
_numbers.Add("Nighn");
_numbers.Add("Ten");
}

public ObservableCollection<BirdsModel> Birds
{
get
{
return _birds;
}
set
{
if (_birds != value)
{
_birds = value;
OnPropertyChanged(new PropertyChangedEventArgs("Birds"));
}
}
}

public ObservableCollection<string> Numbers
{
get
{
return _numbers;
}
set
{
if (_numbers != value)
{
_numbers = value;
OnPropertyChanged(new PropertyChangedEventArgs("Numbers"));
}
}
}
public string Title
{
get
{
return _pageTitle;
}
set
{
if (_pageTitle != value)
{
_pageTitle = value;
OnPropertyChanged(new PropertyChangedEventArgs("Title"));
}
}
}
private void OnPropertyChanged(PropertyChangedEventArgs eventArgs)
{
PropertyChanged?.Invoke(this, eventArgs);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,27 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
mc:Ignorable="d" Title="{Binding Title}"
x:Class="CarouselViewChallenge.Views.CarouselViewChallengePage">
<ContentPage.Content>
<StackLayout BackgroundColor="#cfd8dc">
<Label Text="You can use this page for the CarouselView Challenge!" HorizontalOptions="Center" VerticalOptions="CenterAndExpand"/>
</StackLayout>

<StackLayout>
<CarouselView ItemsSource="{Binding Birds}" PeekAreaInsets="50">
<CarouselView.ItemTemplate>
<DataTemplate>

<StackLayout>
<Frame BorderColor="Gray" Margin="8" HasShadow="True" HeightRequest="280" CornerRadius="20" VerticalOptions="CenterAndExpand">
<StackLayout>
<Image Source="{Binding ImagePath}"/>
<Label Text="{Binding Title}" FontSize="24" FontAttributes="Bold" HorizontalTextAlignment="Center"/>
</StackLayout>
</Frame>
</StackLayout>
</DataTemplate>
</CarouselView.ItemTemplate>
</CarouselView>
</StackLayout>

</ContentPage.Content>
</ContentPage>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using CarouselViewChallenge.ViewModels;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;

Expand All @@ -12,9 +12,12 @@ namespace CarouselViewChallenge.Views
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class CarouselViewChallengePage : ContentPage
{
public CarouselPageViewModel VM { get; set; }
public CarouselViewChallengePage()
{
InitializeComponent();
VM = new CarouselPageViewModel();
BindingContext = VM;
}
}
}