summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla32956.cs
blob: b1baafe57348f19e2473aba1481cc7e9f960c7cd (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
36
37
38
39
40
41
42
43
44
45
46
47
48
using System.Collections.Generic;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
using System.Threading.Tasks;

#if UITEST
using Xamarin.UITest;
using NUnit.Framework;
#endif

namespace Xamarin.Forms.Controls
{
	[Preserve(AllMembers = true)]
	[Issue(IssueTracker.Bugzilla, 32956, "Setting ListView.SelectedItem to null does not remove list item highlight when list item is tapped multiple times quickly", PlatformAffected.Android | PlatformAffected.iOS)]
	public class Bugzilla32956 : TestNavigationPage
	{
		protected override void Init()
		{
			var list = new List<int>();
			for(var i=0; i<10; i++)
				list.Add(i);

			var listView = new ListView
			{
				ItemsSource = list
			};
			listView.ItemSelected += async (sender, args) =>
			{
				if (args.SelectedItem == null)
					return;

				await Task.Delay(1000);
				await Navigation.PushAsync(new ContentPage());
			};

			var contentPage = new ContentPage
			{
				Content = listView
			};
			contentPage.Appearing += (sender, args) =>
			{
				listView.SelectedItem = null;
			};

			PushAsync(contentPage);
		}
	}
}