summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue55555.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue55555.cs')
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue55555.cs88
1 files changed, 88 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue55555.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue55555.cs
new file mode 100644
index 0000000..0aefc55
--- /dev/null
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue55555.cs
@@ -0,0 +1,88 @@
+´╗┐using System;
+using System.Collections.ObjectModel;
+using Xamarin.Forms.CustomAttributes;
+using Xamarin.Forms.Internals;
+
+#if UITEST
+using Xamarin.UITest;
+using NUnit.Framework;
+#endif
+
+namespace Xamarin.Forms.Controls
+{
+ [Preserve(AllMembers = true)]
+ [Issue(IssueTracker.None, 55555, "Header problem")]
+ public class Issue55555 : TestContentPage // or TestMasterDetailPage, etc ...
+ {
+ protected override void Init()
+ {
+ var lstView = new ListView(ListViewCachingStrategy.RecycleElement);
+ ObservableCollection<GroupedVeggieModel> grouped = CreateData();
+
+ lstView.ItemsSource = grouped;
+ lstView.HasUnevenRows = true;
+ lstView.IsGroupingEnabled = true;
+ lstView.GroupDisplayBinding = new Binding("LongName");
+ lstView.GroupShortNameBinding = new Binding("ShortName");
+
+ lstView.ItemTemplate = new DataTemplate(typeof(DemoTextCell));
+ lstView.ItemTemplate.SetBinding(DemoTextCell.TextProperty, "Name");
+
+ Content = lstView;
+ }
+
+ static ObservableCollection<GroupedVeggieModel> CreateData()
+ {
+ var grouped = new ObservableCollection<GroupedVeggieModel>();
+
+ var veggieGroup = new GroupedVeggieModel() { LongName = "vegetables", ShortName = "v" };
+ veggieGroup.Add(new VeggieModel() { Name = "celery", IsReallyAVeggie = true, Comment = "try ants on a log" });
+ veggieGroup.Add(new VeggieModel() { Name = "tomato", IsReallyAVeggie = false, Comment = "pairs well with basil" });
+ veggieGroup.Add(new VeggieModel() { Name = "zucchini", IsReallyAVeggie = true, Comment = "zucchini bread > bannana bread" });
+ veggieGroup.Add(new VeggieModel() { Name = "peas", IsReallyAVeggie = true, Comment = "like peas in a pod" });
+
+ var fruitGroup = new GroupedVeggieModel() { LongName = "fruit", ShortName = "f" };
+ fruitGroup.Add(new VeggieModel() { Name = "banana", IsReallyAVeggie = false, Comment = "available in chip form factor" });
+ fruitGroup.Add(new VeggieModel() { Name = "strawberry", IsReallyAVeggie = false, Comment = "spring plant" });
+ fruitGroup.Add(new VeggieModel() { Name = "cherry", IsReallyAVeggie = false, Comment = "topper for icecream" });
+
+ grouped.Add(veggieGroup);
+ grouped.Add(fruitGroup);
+
+ return grouped;
+ }
+
+ [Preserve(AllMembers = true)]
+ public class VeggieModel
+ {
+ public string Name { get; set; }
+ public string Comment { get; set; }
+ public bool IsReallyAVeggie { get; set; }
+ public string Image { get; set; }
+ }
+
+ [Preserve(AllMembers = true)]
+ public class GroupedVeggieModel : ObservableCollection<VeggieModel>
+ {
+ public string LongName { get; set; }
+ public string ShortName { get; set; }
+ }
+
+ [Preserve(AllMembers = true)]
+ public class DemoTextCell : TextCell
+ {
+ public DemoTextCell()
+ {
+ Height = 150;
+ }
+ }
+
+#if UITEST
+ [Test]
+ public void TGroupDisplayBindingPresentRecycleElementTest()
+ {
+ RunningApp.WaitForElement(q => q.Marked("vegetables"));
+ }
+#endif
+ }
+}