summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues
diff options
context:
space:
mode:
authorSamantha Houts <samantha@teamredwall.com>2016-09-27 06:43:17 -0700
committerRui Marinho <me@ruimarinho.net>2016-09-27 14:43:17 +0100
commitc83c830c68bc0da08f330457dc6901f1657b86f5 (patch)
tree9c376e66dfea3e9d64cbed2ee21d9b540f8f3fae /Xamarin.Forms.Controls.Issues
parent6aa96a43915edaa8fa03ab9bf5abf00fd424f3f1 (diff)
downloadxamarin-forms-c83c830c68bc0da08f330457dc6901f1657b86f5.tar.gz
xamarin-forms-c83c830c68bc0da08f330457dc6901f1657b86f5.tar.bz2
xamarin-forms-c83c830c68bc0da08f330457dc6901f1657b86f5.zip
[UWP/WinRT] ListView UI virtualization works without explicit height on Cell/Row (#367)
* Add repro for 41271 * [UWP/WinRT] ListView virtualization works without explicit height on Cell/Row * Adjust repro to clear ItemsSource OnDisappearing. * Update docs
Diffstat (limited to 'Xamarin.Forms.Controls.Issues')
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla41271.cs107
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems1
2 files changed, 108 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla41271.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla41271.cs
new file mode 100644
index 00000000..5c545634
--- /dev/null
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla41271.cs
@@ -0,0 +1,107 @@
+using System.Collections.Generic;
+using Xamarin.Forms.CustomAttributes;
+using Xamarin.Forms.Internals;
+
+namespace Xamarin.Forms.Controls
+{
+ [Preserve(AllMembers = true)]
+ [Issue(IssueTracker.Bugzilla, 41271, "[UWP] Memory Leak from ListView in TabbedPage")]
+ public class Bugzilla41271 : TestTabbedPage
+ {
+ [Preserve(AllMembers = true)]
+ class Person
+ {
+ public Person(string firstName, string lastName, string city, string state)
+ {
+ FirstName = firstName;
+ LastName = lastName;
+ City = city;
+ State = state;
+ }
+ public string FirstName { get; set; }
+ public string LastName { get; set; }
+ public string City { get; set; }
+ public string State { get; set; }
+ }
+ [Preserve(AllMembers = true)]
+ class ListViewCell : ViewCell
+ {
+ Label firstNameLabel = new Label();
+ Label lastNameLabel = new Label();
+ Label cityLabel = new Label();
+ Label stateLabel = new Label();
+
+ public ListViewCell()
+ {
+ View = new StackLayout
+ {
+ Orientation = StackOrientation.Horizontal,
+ Children =
+ {
+ firstNameLabel,
+ lastNameLabel,
+ cityLabel,
+ stateLabel
+ }
+ };
+ }
+
+ protected override void OnBindingContextChanged()
+ {
+ base.OnBindingContextChanged();
+ var item = BindingContext as Person;
+ if (item != null)
+ {
+ firstNameLabel.Text = item.FirstName;
+ lastNameLabel.Text = item.LastName;
+ cityLabel.Text = item.City;
+ stateLabel.Text = item.State;
+ }
+ }
+ }
+ [Preserve(AllMembers = true)]
+ class ListViewPage : ContentPage
+ {
+ ListView _ListView;
+ List<Person> _People = new List<Person>();
+
+ public ListViewPage(string id)
+ {
+ Title = $"List {id}";
+
+ for (var x = 0; x < 1000; x++)
+ {
+ _People.Add(new Person("Bob", "Bobson", "San Francisco", "California"));
+ }
+
+ _ListView = new ListView(ListViewCachingStrategy.RecycleElement) { ItemTemplate = new DataTemplate(typeof(ListViewCell)) };
+ Content = _ListView;
+ }
+
+ protected override void OnAppearing()
+ {
+ base.OnAppearing();
+
+ _ListView.ItemsSource = _People;
+ }
+
+ protected override void OnDisappearing()
+ {
+ base.OnDisappearing();
+
+ _ListView.ItemsSource = null;
+ }
+ }
+
+ protected override void Init()
+ {
+ var counter = 1;
+
+ for (var x = 0; x < 10; x++)
+ {
+ Children.Add(new ListViewPage(counter.ToString()));
+ counter++;
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
index 7a47c10f..427a3845 100644
--- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
@@ -182,6 +182,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla33561.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla43214.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla43161.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)Bugzilla41271.cs" />
<Compile Include="$(MSBuildThisFileDirectory)_Template.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue1028.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue1075.cs" />