summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues
diff options
context:
space:
mode:
authorSamantha Houts <samantha@teamredwall.com>2017-03-14 03:30:22 -0700
committerRui Marinho <me@ruimarinho.net>2017-03-14 10:30:22 +0000
commite7f5a4188d2c102a3eada30b2d55a5e7ee481f1d (patch)
tree810a387a1b03ba5d63fc130fd566be80225665b5 /Xamarin.Forms.Controls.Issues
parentb23e40a2010f93164e36c90e411c2cc0d5d4e60e (diff)
downloadxamarin-forms-e7f5a4188d2c102a3eada30b2d55a5e7ee481f1d.tar.gz
xamarin-forms-e7f5a4188d2c102a3eada30b2d55a5e7ee481f1d.tar.bz2
xamarin-forms-e7f5a4188d2c102a3eada30b2d55a5e7ee481f1d.zip
[iOS] ViewCells will respond to ForceUpdateSize in RecycleElement mode (#809)
* Add reproduction for 44525 * Clean up gallery page * [iOS] Get index path from Cell in RecycleElement * Fix obsolete code
Diffstat (limited to 'Xamarin.Forms.Controls.Issues')
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla44525.cs104
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems1
2 files changed, 105 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla44525.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla44525.cs
new file mode 100644
index 00000000..e159aa71
--- /dev/null
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla44525.cs
@@ -0,0 +1,104 @@
+using System;
+using System.Linq;
+using System.Collections.Generic;
+using Xamarin.Forms.CustomAttributes;
+using Xamarin.Forms.Internals;
+using System.ComponentModel;
+
+namespace Xamarin.Forms.Controls
+{
+ [Preserve(AllMembers = true)]
+ [Issue(IssueTracker.Bugzilla, 44525, "Listview Row Height Does Not Adapt In iOS")]
+ public class Bugzilla44525 : TestContentPage
+ {
+ List<Person> _DataSource;
+
+ [Preserve(AllMembers = true)]
+ class CustomCell : ViewCell
+ {
+ public CustomCell()
+ {
+ Label age = new Label();
+ Label name = new Label();
+ StackLayout cellWrapper = new StackLayout();
+
+ age.SetBinding(Label.TextProperty, "Age");
+ name.SetBinding(Label.TextProperty, "Name");
+
+ age.PropertyChanged += UpdateCell;
+ name.PropertyChanged += UpdateCell;
+
+ cellWrapper.Children.Add(age);
+ cellWrapper.Children.Add(name);
+
+ View = cellWrapper;
+ }
+
+ void UpdateCell(object sender, PropertyChangedEventArgs e)
+ {
+ if (e.PropertyName == Label.TextProperty.PropertyName)
+ {
+ ForceUpdateSize();
+ }
+ }
+ }
+
+ class Person : ViewModelBase
+ {
+ private string _Name;
+ public string Name
+ {
+ get
+ {
+ return _Name;
+ }
+ set
+ {
+ if (_Name == value)
+ return;
+
+ _Name = value;
+ OnPropertyChanged();
+ }
+ }
+
+ private string _Age;
+ public string Age
+ {
+ get
+ {
+ return _Age;
+ }
+ set
+ {
+ if (_Age == value)
+ return;
+
+ _Age = value;
+ OnPropertyChanged();
+ }
+ }
+ }
+
+ protected override void Init()
+ {
+ _DataSource = Enumerable.Range(1, 100).Select(c => new Person { Name = $"Person {c}", Age = $"{c} year(s) old" }).ToList();
+
+ var listView = new ListView(ListViewCachingStrategy.RecycleElement)
+ {
+ ItemTemplate = new DataTemplate(typeof(CustomCell)),
+ ItemsSource = _DataSource,
+ HasUnevenRows = true
+ };
+
+ var button = new Button { Text = "Click me" };
+ button.Clicked += (sender, e) =>
+ {
+ var target = _DataSource[1];
+ target.Name = "I am an exceptionally long string that should cause the label to wrap, thus increasing the size of the ViewCell such that the entirety of the string is readable by human eyes. Hurrah.";
+ };
+
+ Content = new StackLayout { Children = { button, listView } };
+ }
+ }
+}
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 99f2bf81..38fc48a0 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
@@ -247,6 +247,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla40722.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla41153.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla44129.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)Bugzilla44525.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla28650.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla37431.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla44777.cs" />