summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla33450.cs
blob: 43b404d6464a1194bb1e2f3a818f0f22704e24a3 (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 Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;

namespace Xamarin.Forms.Controls
{
	[Preserve (AllMembers = true)]
	[Issue (IssueTracker.Bugzilla, 33450, "[iOS] Cell with ContextAction has a different layout")]
	public class Bugzilla33450 : TestContentPage // or TestMasterDetailPage, etc ...
	{
		protected override void Init ()
		{
			var list = new ListView { ItemTemplate = new DataTemplate (typeof(MyImageCell)) };

			list.ItemsSource = new[] {
				"One",
				"Two",
				"Three",
				"Four",
				"Five",
				"Six",
				"Seven",
				"Eight",
				"Nine",
				"Ten",
			};

			Content = list;
		}

		[Preserve (AllMembers = true)]
		public class MyImageCell : ImageCell
		{
			static bool s_addContextAction = false;

			public MyImageCell()
			{
				ImageSource = "bank.png";
				SetBinding(TextProperty, new Binding("."));
			
				if(s_addContextAction)
				{
					ContextActions.Add(new MenuItem() { Text = "Delete" });
				}
				s_addContextAction = !s_addContextAction;
			}
		}
	}
}