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
|
using System.Collections.Generic;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
namespace Xamarin.Forms.Controls
{
[Preserve (AllMembers = true)]
[Issue (IssueTracker.Bugzilla, 24769, "Layout cycle when Progress Bar is in a ListView", PlatformAffected.WinPhone | PlatformAffected.WinRT)]
public class Bugzilla24769 : TestContentPage
{
protected override void Init ()
{
var instructions = new Label () {
Text = @"Click the button labeled 'Progress++' three times. Each time, all four ProgressBar controls should increment. If they do not increment, the test has failed."
};
var items = new List<ListItem> {
new ListItem { Name = "Item1" },
new ListItem { Name = "Item2" },
new ListItem { Name = "Item3" }
};
var btn = new Button {
Text = "Progress++"
};
var progressBar = new ProgressBar { Progress = 0.1 };
btn.Clicked += (sender, arg) => {
MessagingCenter.Send (this, "set_progress");
progressBar.Progress += 0.1;
};
var list = new ListView {
ItemsSource = items,
ItemTemplate = new DataTemplate (typeof(ListCell))
};
BackgroundColor = Color.Maroon;
Content = new StackLayout {
VerticalOptions = LayoutOptions.Fill,
HorizontalOptions = LayoutOptions.Fill,
Children = {
instructions,
btn,
progressBar,
list
}
};
}
}
internal class ListCell : ViewCell
{
public ListCell ()
{
var label = new Label ();
label.SetBinding (Label.TextProperty, "Name");
var progress = new ProgressBar { Progress = 0.1 };
MessagingCenter.Subscribe<Bugzilla24769> (this, "set_progress", sender => { progress.Progress += 0.1; });
View =
new StackLayout {
HorizontalOptions = LayoutOptions.Fill,
BackgroundColor = Color.Gray,
Children = {
label,
progress
}
};
}
}
internal class ListItem
{
public string Name { get; set; }
}
}
|