summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue1557.cs
blob: 1bf9b71001a4628dd235584ced2aef174de94105 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;

namespace Xamarin.Forms.Controls
{
	[Preserve (AllMembers=true)]
	[Issue (IssueTracker.Github, 1557, "Setting source crashes if view was detached from visual tree", PlatformAffected.iOS)]
	public class Issue1557
		: ContentPage
	{
		ObservableCollection<string>  _items = new ObservableCollection<string> { "foo", "bar" };
		public Issue1557()
		{
			Content = new ListView {
				ItemsSource = _items
			};

			Task.Delay (3000).ContinueWith (async t => {
				var list = (ListView) Content;

				await Navigation.PopAsync();

				list.ItemsSource = new List<string>() { "test" };

			}, TaskScheduler.FromCurrentSynchronizationContext());
		}
	}
}