summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla27779.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla27779.cs')
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla27779.cs83
1 files changed, 83 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla27779.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla27779.cs
new file mode 100644
index 00000000..271c4b05
--- /dev/null
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla27779.cs
@@ -0,0 +1,83 @@
+using System;
+
+using Xamarin.Forms.CustomAttributes;
+using System.Collections.Generic;
+
+#if UITEST
+using Xamarin.UITest;
+using NUnit.Framework;
+#endif
+
+namespace Xamarin.Forms.Controls
+{
+ [Preserve (AllMembers = true)]
+ [Issue (IssueTracker.Bugzilla, 27779, "Xamarin.Forms.ReadOnlyListAdapter.IndexOf throws NotImplementedExcpetion ")]
+ public class Bugzilla27779 : TestContentPage // or TestMasterDetailPage, etc ...
+ {
+ ListView _listview;
+ IReadOnlyList<Person> _itemsSource;
+
+ public class Source : IReadOnlyList<Person>
+ {
+ List<Person> _items;
+ public Source ()
+ {
+ _items = new List<Person> ();
+
+ for (int i = 0; i < 100; i++) {
+ _items.Add (new Person ("Person #" + i));
+ }
+
+ }
+ #region IEnumerable implementation
+ public IEnumerator<Person> GetEnumerator ()
+ {
+ return _items.GetEnumerator ();
+ }
+ #endregion
+ #region IEnumerable implementation
+ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator ()
+ {
+ return _items.GetEnumerator ();
+ }
+ #endregion
+ #region IReadOnlyList implementation
+ public Person this [int index] {
+ get {
+ return _items [index];
+ }
+ }
+ #endregion
+ #region IReadOnlyCollection implementation
+ public int Count {
+ get {
+ return _items.Count;
+ }
+ }
+ #endregion
+
+ }
+ protected override void Init ()
+ {
+
+ _itemsSource = new Source();
+
+ _listview = new ListView {
+ ItemsSource = _itemsSource
+ };
+
+ var btn = new Button { Text = "Set selected", AutomationId="btnSelect" };
+ btn.Clicked+= (object sender, EventArgs e) => {
+ _listview.SelectedItem = _itemsSource [0];
+ };
+
+ Content = new StackLayout { Children = { btn, _listview } };
+ }
+
+ protected override void OnAppearing ()
+ {
+ base.OnAppearing ();
+ }
+
+ }
+}