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
|
using Xamarin.Forms.CustomAttributes;
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;
}
}
}
}
|