diff --git a/CollectionViewChallenge/CollectionViewChallenge.Android/CollectionViewChallenge.Android.csproj b/CollectionViewChallenge/CollectionViewChallenge.Android/CollectionViewChallenge.Android.csproj
index b56a767..416df70 100644
--- a/CollectionViewChallenge/CollectionViewChallenge.Android/CollectionViewChallenge.Android.csproj
+++ b/CollectionViewChallenge/CollectionViewChallenge.Android/CollectionViewChallenge.Android.csproj
@@ -30,7 +30,11 @@
DEBUG;
prompt
4
- None
+ SdkOnly
+ false
+ false
+ false
+
true
@@ -106,5 +110,8 @@
CollectionViewChallenge
+
+
+
\ No newline at end of file
diff --git a/CollectionViewChallenge/CollectionViewChallenge.Android/Resources/drawable/down_arrow.png b/CollectionViewChallenge/CollectionViewChallenge.Android/Resources/drawable/down_arrow.png
new file mode 100644
index 0000000..ce04ee0
Binary files /dev/null and b/CollectionViewChallenge/CollectionViewChallenge.Android/Resources/drawable/down_arrow.png differ
diff --git a/CollectionViewChallenge/CollectionViewChallenge.iOS/CollectionViewChallenge.iOS.csproj b/CollectionViewChallenge/CollectionViewChallenge.iOS/CollectionViewChallenge.iOS.csproj
index d4eb946..93196af 100644
--- a/CollectionViewChallenge/CollectionViewChallenge.iOS/CollectionViewChallenge.iOS.csproj
+++ b/CollectionViewChallenge/CollectionViewChallenge.iOS/CollectionViewChallenge.iOS.csproj
@@ -25,7 +25,7 @@
4
false
x86_64
- None
+ SdkOnly
true
@@ -143,4 +143,7 @@
CollectionViewChallenge
+
+
+
\ No newline at end of file
diff --git a/CollectionViewChallenge/CollectionViewChallenge.iOS/Resources/down_arrow.png b/CollectionViewChallenge/CollectionViewChallenge.iOS/Resources/down_arrow.png
new file mode 100644
index 0000000..ce04ee0
Binary files /dev/null and b/CollectionViewChallenge/CollectionViewChallenge.iOS/Resources/down_arrow.png differ
diff --git a/CollectionViewChallenge/CollectionViewChallenge/CollectionViewChallenge.csproj b/CollectionViewChallenge/CollectionViewChallenge/CollectionViewChallenge.csproj
index 83a6bc4..d8da61a 100644
--- a/CollectionViewChallenge/CollectionViewChallenge/CollectionViewChallenge.csproj
+++ b/CollectionViewChallenge/CollectionViewChallenge/CollectionViewChallenge.csproj
@@ -22,7 +22,6 @@
-
\ No newline at end of file
diff --git a/CollectionViewChallenge/CollectionViewChallenge/Models/Event.cs b/CollectionViewChallenge/CollectionViewChallenge/Models/Event.cs
new file mode 100644
index 0000000..7e3bebd
--- /dev/null
+++ b/CollectionViewChallenge/CollectionViewChallenge/Models/Event.cs
@@ -0,0 +1,32 @@
+using System;
+using System.ComponentModel;
+
+namespace CollectionViewChallenge.Models
+{
+ public class Event : INotifyPropertyChanged
+ {
+ public int ID { get; set; }
+ public string Title { get; set; }
+ public string Description { get; set; }
+ public DateTime StartDate { get; set; }
+ public DateTime EndDate { get; set; }
+ public DateTime SubmittedOn { get; set; }
+ public int Points { get; set; }
+
+ private bool _DropDownVisible;
+ public bool DropDownVisible
+ {
+ get { return _DropDownVisible; }
+ set
+ {
+ if(_DropDownVisible != value)
+ {
+ _DropDownVisible = value;
+ PropertyChanged(this, new PropertyChangedEventArgs("DropDownVisible"));
+ }
+ }
+ }
+
+ public event PropertyChangedEventHandler PropertyChanged;
+ }
+}
diff --git a/CollectionViewChallenge/CollectionViewChallenge/Views/CollectionViewChallengePage.xaml b/CollectionViewChallenge/CollectionViewChallenge/Views/CollectionViewChallengePage.xaml
index e934760..c7af034 100644
--- a/CollectionViewChallenge/CollectionViewChallenge/Views/CollectionViewChallengePage.xaml
+++ b/CollectionViewChallenge/CollectionViewChallenge/Views/CollectionViewChallengePage.xaml
@@ -1,25 +1,40 @@
+ x:Class="CollectionViewChallenge.Views.CollectionViewChallengePage"
+ BackgroundColor="#40407a">
-
-
-
- This is a CollectionView!
- Your feedback on the experience of converting a ListView to a CollectionView is incredibly appreciated.
- Here are three general questions:
- 1. How was the experience of converting your existing ListView to a CollectionView?
- 2. How is the performance compared to the ListView?
- 3. Is there a specific piece of functionality that you'd like to see?
-
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/CollectionViewChallenge/CollectionViewChallenge/Views/CollectionViewChallengePage.xaml.cs b/CollectionViewChallenge/CollectionViewChallenge/Views/CollectionViewChallengePage.xaml.cs
index 701124f..4ac4f54 100644
--- a/CollectionViewChallenge/CollectionViewChallenge/Views/CollectionViewChallengePage.xaml.cs
+++ b/CollectionViewChallenge/CollectionViewChallenge/Views/CollectionViewChallengePage.xaml.cs
@@ -1,8 +1,8 @@
-using System;
+using CollectionViewChallenge.Models;
+using System;
using System.Collections.Generic;
+using System.Collections.ObjectModel;
using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
@@ -12,9 +12,41 @@ namespace CollectionViewChallenge.Views
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class CollectionViewChallengePage : ContentPage
{
+ ObservableCollection obsEvents = new ObservableCollection();
+
public CollectionViewChallengePage()
{
InitializeComponent();
+ LoadCollectionView();
+ cvEvents.SelectionChanged += CvEvents_SelectionChanged;
+ }
+
+ private void CvEvents_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ var eventItem = (e.CurrentSelection.FirstOrDefault() as Event);
+
+ if (eventItem is null)
+ return;
+
+ //Hack to reflect the DropDownVisible changes on selected item
+ var iSelectedIndex = obsEvents.IndexOf(eventItem);
+ obsEvents.Remove(eventItem);
+ eventItem.DropDownVisible = !eventItem.DropDownVisible;
+ obsEvents.Insert(iSelectedIndex, eventItem);
+
+ //This is required when expanded item is selected again, it should be collapsed
+ ((CollectionView)sender).SelectedItem = null;
+ }
+
+ private void LoadCollectionView()
+ {
+ var lstEvents = new List();
+ for (var i = 1; i <= 20; i++)
+ {
+ lstEvents.Add(new Event() { ID = i, Title = "Phasellus ultrices nulla quis nibh", Description = "placerat", StartDate = DateTime.Now, EndDate = DateTime.Now, SubmittedOn = DateTime.Now, Points = 2 });
+ }
+ obsEvents = new ObservableCollection(lstEvents);
+ cvEvents.ItemsSource = obsEvents;
}
}
}
\ No newline at end of file