summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Core
diff options
context:
space:
mode:
authorkingces95 <kingces95@users.noreply.github.com>2016-04-07 14:55:19 -0700
committerRui Marinho <me@ruimarinho.net>2016-04-07 22:55:19 +0100
commit870f9c98ffccce86d80c6ff7a05de7238fc1b0e8 (patch)
tree5d754265da426d5afef51ce2001257ae07acfa56 /Xamarin.Forms.Core
parente9eaacff4a1ee16729ae434d44fe0f9846712ef3 (diff)
downloadxamarin-forms-870f9c98ffccce86d80c6ff7a05de7238fc1b0e8.tar.gz
xamarin-forms-870f9c98ffccce86d80c6ff7a05de7238fc1b0e8.tar.bz2
xamarin-forms-870f9c98ffccce86d80c6ff7a05de7238fc1b0e8.zip
[A, iOS] CarouselView Bug Fixes (#49)
* CarouselView programatic scrolling fixes; swipe back fixes * Make iOS CarouselView events consistant with Android * bump swipe distance; add Screenshot on Exception * Formatting. No logical change. * Comment out [Test] on UITest and fix TestCloud failures later.
Diffstat (limited to 'Xamarin.Forms.Core')
-rw-r--r--Xamarin.Forms.Core/ItemsViewSimple.cs23
1 files changed, 19 insertions, 4 deletions
diff --git a/Xamarin.Forms.Core/ItemsViewSimple.cs b/Xamarin.Forms.Core/ItemsViewSimple.cs
index 34b77264..51b9df7a 100644
--- a/Xamarin.Forms.Core/ItemsViewSimple.cs
+++ b/Xamarin.Forms.Core/ItemsViewSimple.cs
@@ -9,9 +9,20 @@ namespace Xamarin.Forms
{
public abstract class ItemsView : View, IItemViewController
{
- public static readonly BindableProperty ItemsSourceProperty = BindableProperty.Create("ItemsSource", typeof(IEnumerable), typeof(ItemsView), Enumerable.Empty<object>());
-
- public static readonly BindableProperty ItemTemplateProperty = BindableProperty.Create("ItemTemplate", typeof(DataTemplate), typeof(ItemsView));
+ public static readonly BindableProperty ItemsSourceProperty =
+ BindableProperty.Create(
+ propertyName: "ItemsSource",
+ returnType: typeof(IEnumerable),
+ declaringType: typeof(ItemsView),
+ defaultValue: Enumerable.Empty<object>()
+ );
+
+ public static readonly BindableProperty ItemTemplateProperty =
+ BindableProperty.Create(
+ propertyName: "ItemTemplate",
+ returnType: typeof(DataTemplate),
+ declaringType: typeof(ItemsView)
+ );
ItemSource _itemSource;
@@ -66,8 +77,12 @@ namespace Xamarin.Forms
{
if (propertyName == nameof(ItemsSource))
{
+ var itemsSource = ItemsSource;
+ if (itemsSource == null)
+ itemsSource = Enumerable.Empty<object>();
+
// abstract enumerable, IList, IList<T>, and IReadOnlyList<T>
- _itemSource = new ItemSource(ItemsSource);
+ _itemSource = new ItemSource(itemsSource);
// subscribe to collection changed events
var dynamicItemSource = _itemSource as INotifyCollectionChanged;