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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
using System;
using Xamarin.Forms.CustomAttributes;
using System.Collections.Generic;
using Xamarin.Forms.Internals;
#if UITEST
using Xamarin.UITest;
using NUnit.Framework;
#endif
namespace Xamarin.Forms.Controls
{
[Preserve (AllMembers = true)]
[Issue (IssueTracker.Github, 2775, "ViewCell background conflicts with ListView Semi-Transparent and Transparent backgrounds")]
public class Issue2775 : TestContentPage // or TestMasterDetailPage, etc ...
{
protected override void Init ()
{
var list = new ListView {
ItemsSource = GetList ("Normal BG Blue"),
BackgroundColor = Color.Blue,
ItemTemplate = new DataTemplate (typeof(NormalCell))
};
var listTransparent = new ListView {
ItemsSource = GetList ("Normal BG Transparent"),
BackgroundColor = Color.Transparent,
ItemTemplate = new DataTemplate (typeof(NormalCell))
};
var listSemiTransparent = new ListView {
ItemsSource = GetList ("Normal BG SEMI Transparent"),
BackgroundColor = Color.FromHex("#801B2A39"),
ItemTemplate = new DataTemplate (typeof(NormalCell))
};
var listContextActions = new ListView {
ItemsSource = GetList ("ContextActions BG PINK"),
BackgroundColor = Color.Pink,
ItemTemplate = new DataTemplate (typeof(ContextActionsCell))
};
var listContextActionsTransparent = new ListView {
ItemsSource = GetList ("ContextActions BG Transparent"),
BackgroundColor = Color.Transparent,
ItemTemplate = new DataTemplate (typeof(ContextActionsCell))
};
var listContextActionsSemiTransparent = new ListView {
ItemsSource = GetList ("ContextActions BG Semi Transparent"),
BackgroundColor = Color.FromHex("#801B2A39"),
ItemTemplate = new DataTemplate (typeof(ContextActionsCell))
};
Content = new StackLayout {
Children = {
list,
listTransparent,
listSemiTransparent,
listContextActions,
listContextActionsTransparent,
listContextActionsSemiTransparent
},
BackgroundColor = Color.Red
};
}
[Preserve (AllMembers = true)]
internal class ContextActionsCell : ViewCell
{
public ContextActionsCell ()
{
ContextActions.Add (new MenuItem{ Text = "action" });
var label = new Label ();
label.SetBinding (Label.TextProperty, "Name");
View = label;
}
}
[Preserve (AllMembers = true)]
internal class NormalCell : ViewCell
{
public NormalCell ()
{
var label = new Label ();
label.SetBinding (Label.TextProperty, "Name");
View = label;
}
}
List<ListItemViewModel> GetList (string description)
{
var itemList = new List<ListItemViewModel> ();
for (var i = 1; i < 3; i++) {
itemList.Add (new ListItemViewModel () { Name = description });
}
return itemList;
}
[Preserve (AllMembers = true)]
public class ListItemViewModel
{
public string Name { get; set; }
}
#if UITEST
[Test]
public void Issue2775Test ()
{
RunningApp.Screenshot ("I am at Issue 2775");
//RunningApp.WaitForElement (q => q.Marked ("IssuePageLabel"));
RunningApp.Screenshot ("I see the Label");
}
#endif
}
}
|