summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues
diff options
context:
space:
mode:
authorVitaly Knyazev <VitalyKnyazev@users.noreply.github.com>2017-03-14 16:22:21 +0000
committerRui Marinho <me@ruimarinho.net>2017-03-14 18:25:12 +0000
commit2a300b070c7cbcdb36fbbebb371fd092dc7c020b (patch)
tree08595aaeacfd32311ae20890cf04b8ff9c7e2d70 /Xamarin.Forms.Controls.Issues
parent2c26d11bf435c0443dd54b379478353559cefdeb (diff)
downloadxamarin-forms-2a300b070c7cbcdb36fbbebb371fd092dc7c020b.tar.gz
xamarin-forms-2a300b070c7cbcdb36fbbebb371fd092dc7c020b.tar.bz2
xamarin-forms-2a300b070c7cbcdb36fbbebb371fd092dc7c020b.zip
Bug 51536, initial iOS cell layout is incorrect when cell has context actions … (#787)
* Bug 51536, initial height is incorrect when cell has context actions or ListView is in recycle mode * Improved fix for iOS uneven height cell layout * Fixed indentation and added test case for issue 44525 * Fixed indentation for test case * Added 1px room, this will fix Bugzilla31330 test, renamed test case to 51536 * Updated shared project file
Diffstat (limited to 'Xamarin.Forms.Controls.Issues')
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla51536.cs81
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems2
2 files changed, 83 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla51536.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla51536.cs
new file mode 100644
index 00000000..05149128
--- /dev/null
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla51536.cs
@@ -0,0 +1,81 @@
+using System.Linq;
+using Xamarin.Forms.CustomAttributes;
+using Xamarin.Forms.Internals;
+
+namespace Xamarin.Forms.Controls.Issues
+{
+ [Preserve(AllMembers = true)]
+ [Issue(IssueTracker.Bugzilla, 51536, "[iOS] Xamarin.Forms ListView Row Height Does Not Adapt")]
+ public class Bugzilla51536 : TestContentPage
+ {
+ protected override void Init()
+ {
+ const string InstructionsLong = "On iOS, all the list items below will have different height defined by this text, the text " +
+ "should be wrapped and take all cell space. If this text is not wrapped and there is a lot of " +
+ "whitespace in the cell then this test has failed. This error was happening to ListView with RecycleElement mode " +
+ "or when cell has context actions.";
+
+ const string InstructionsShort = "On iOS, all the list items below will have different height defined by this text.";
+
+ var listItems = Enumerable.Range(1, 100).Select(i => new ItemViewModel
+ {
+ Name = "Item" + i,
+ Description = i % 2 == 0 ? (InstructionsLong + i) : (InstructionsShort + i)
+ }).ToArray();
+
+ var listView = new ListView(ListViewCachingStrategy.RecycleElement)
+ {
+ ItemTemplate = new DataTemplate(typeof(ItemViewCell)),
+ HasUnevenRows = true,
+ ItemsSource = listItems
+ };
+
+ Content = listView;
+ }
+ }
+
+ [Preserve(AllMembers = true)]
+ public sealed class ItemViewModel
+ {
+ public string Name { get; set; }
+ public string Description { get; set; }
+ }
+
+ [Preserve(AllMembers = true)]
+ public sealed class ItemViewCell : ViewCell
+ {
+ public Label Label1 { get; set; }
+ public Label Label2 { get; set; }
+
+ public ItemViewCell()
+ {
+ var stackLayout = new StackLayout
+ {
+ Orientation = StackOrientation.Vertical,
+ HorizontalOptions = LayoutOptions.StartAndExpand,
+ VerticalOptions = LayoutOptions.StartAndExpand
+ };
+
+ Label1 = new Label();
+ Label2 = new Label { LineBreakMode = LineBreakMode.WordWrap };
+
+ stackLayout.Children.Add(Label1);
+ stackLayout.Children.Add(Label2);
+
+ View = stackLayout;
+ }
+
+ protected override void OnBindingContextChanged()
+ {
+ base.OnBindingContextChanged();
+
+ var item = BindingContext as ItemViewModel;
+
+ if (item != null)
+ {
+ Label1.Text = item.Name;
+ Label2.Text = item.Description;
+ }
+ }
+ }
+} \ 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 77b8f4e5..b2f79492 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
@@ -142,6 +142,8 @@
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla43663.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla43735.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla44453.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)Bugzilla51536.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)Bugzilla44940.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla44944.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla44166.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla44461.cs" />