summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla33870.cs
diff options
context:
space:
mode:
authorJason Smith <jason.smith@xamarin.com>2016-03-22 13:02:25 -0700
committerJason Smith <jason.smith@xamarin.com>2016-03-22 16:13:41 -0700
commit17fdde66d94155fc62a034fa6658995bef6fd6e5 (patch)
treeb5e5073a2a7b15cdbe826faa5c763e270a505729 /Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla33870.cs
downloadxamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.tar.gz
xamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.tar.bz2
xamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.zip
Initial import
Diffstat (limited to 'Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla33870.cs')
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla33870.cs71
1 files changed, 71 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla33870.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla33870.cs
new file mode 100644
index 00000000..d0d9bbc6
--- /dev/null
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla33870.cs
@@ -0,0 +1,71 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
+using Xamarin.Forms.CustomAttributes;
+
+namespace Xamarin.Forms.Controls
+{
+
+ [Preserve (AllMembers = true)]
+ [Issue (IssueTracker.Bugzilla, 33870, "[W] Crash when the ListView Selection is set to null", PlatformAffected.WinRT)]
+ public class Bugzilla33870 : TestContentPage
+ {
+ public class Section : ObservableCollection<string>
+ {
+ public Section (string title, IEnumerable<string> items = null)
+ : this (items ?? new List<string> ())
+ {
+ Title = title;
+ }
+
+ public Section (IEnumerable<string> items)
+ : base (items)
+ { }
+
+ public string Title { get; set; }
+ }
+
+ protected override void Init ()
+ {
+ var source = new ObservableCollection<Section> {
+ new Section("SECTION 1") {
+ "ITEM 1",
+ "ITEM 2",
+ },
+ new Section("SECTION 2") {
+ "ITEM 3",
+ "CLEAR SELECTION",
+ }
+ };
+
+ var listview = new ListView {
+ ItemsSource = source,
+ IsGroupingEnabled = true,
+ GroupDisplayBinding = Binding.Create<Section> (x => x.Title),
+ };
+
+ var label = new Label { Text = "Tap CLEAR SELECTION. If the app does not crash and no item is selected, the test has passed." };
+
+ listview.ItemSelected += (sender, args) =>
+ {
+ string selecteditem = args.SelectedItem?.ToString ();
+ label.Text = selecteditem;
+ if (selecteditem == "CLEAR SELECTION") {
+ label.Text = "cleared";
+ ((ListView) sender).SelectedItem = null;
+ }
+ };
+
+ var stack = new StackLayout {
+ Children = {
+ label,
+ listview
+ }
+ };
+
+ Content = stack;
+ }
+ }
+}