diff options
author | Jason Smith <jason.smith@xamarin.com> | 2016-03-22 13:02:25 -0700 |
---|---|---|
committer | Jason Smith <jason.smith@xamarin.com> | 2016-03-22 16:13:41 -0700 |
commit | 17fdde66d94155fc62a034fa6658995bef6fd6e5 (patch) | |
tree | b5e5073a2a7b15cdbe826faa5c763e270a505729 /Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla27779.cs | |
download | xamarin-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/Bugzilla27779.cs')
-rw-r--r-- | Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla27779.cs | 83 |
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 (); + } + + } +} |