Skip to content

Commit

Permalink
Disable packager for CollectionView on UWP (xamarin#8404)
Browse files Browse the repository at this point in the history
* Reproduce issue 8366

* Clean up old comments

* Turn off packaging for the CollectionView on UWP
Fixes xamarin#8366
  • Loading branch information
hartez authored and jfversluis committed Nov 18, 2019
1 parent e640a19 commit 43b0607
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
using System;
using System.Collections.Generic;
using System.Text;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;

#if UITEST
using Xamarin.Forms.Core.UITests;
using Xamarin.UITest;
using NUnit.Framework;
#endif

namespace Xamarin.Forms.Controls.Issues
{
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Bugzilla, 8366, "[Bug] UWP CollectionView Floating Row and Toolbar clipped")]
public class Issue8366 : TestMasterDetailPage
{
NavigationPage _items;
NavigationPage _other;

protected override void Init()
{
MasterBehavior = MasterBehavior.Split;

_items = new NavigationPage(Items());
_other = new NavigationPage(Other());

Detail = _items;
Master = MasterPage();
}

ContentPage MasterPage()
{
var page = new ContentPage();

var menu = new StackLayout();

var instructions = new Label { Margin = 3, Text = "Tap 'Other' to change the Detail page. " +
"Then tap 'Items' to return to this page. " +
"If the CollectionView does not show a garbled mess at the top, this test has passed." };

menu.Children.Add(instructions);

var buttonItems = new Button { Text = "Items" };
var buttonOther = new Button { Text = "Other" };

page.Content = menu;

buttonItems.Clicked += (sender, args) => { Detail = _items; };
buttonOther.Clicked += (sender, args) => { Detail = _other; };

menu.Children.Add(buttonItems);
menu.Children.Add(buttonOther);

page.Title = "8366 Master";

return page;
}

ContentPage Items()
{
var page = new ContentPage
{
Title = "Items"
};

var cv = new CollectionView();

var items = new List<string>() { "uno", "dos", "tres" };

cv.ItemsSource = items;

cv.ItemTemplate = new DataTemplate(() => {
var root = new Label();
root.SetBinding(Label.TextProperty, new Binding("."));
return root;
});

page.Content = cv;

return page;
}

ContentPage Other()
{
var page = new ContentPage
{
Title = "Other",
Content = new Label { Text = "Other page" }
};

return page;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Issue8222.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue8167.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue8366.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue8269.cs" />
<Compile Include="$(MSBuildThisFileDirectory)RefreshViewTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue7338.cs" />
Expand Down
5 changes: 0 additions & 5 deletions Xamarin.Forms.Core/Items/ItemsView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,6 @@ public void RemoveLogicalChild(Element element)
BindableProperty.Create(nameof(ItemsLayout), typeof(IItemsLayout), typeof(ItemsView),
LinearItemsLayout.Vertical);


// public abstract IItemsLayout ItemsLayout { get; }


protected IItemsLayout InternalItemsLayout
{
get => (IItemsLayout)GetValue(InternalItemsLayoutProperty);
Expand All @@ -144,7 +140,6 @@ public ItemSizingStrategy ItemSizingStrategy
set => SetValue(ItemSizingStrategyProperty, value);
}


public static readonly BindableProperty ItemTemplateProperty =
BindableProperty.Create(nameof(ItemTemplate), typeof(DataTemplate), typeof(ItemsView));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ public abstract class ItemsViewRenderer<TItemsView> : ViewRenderer<TItemsView, L
FrameworkElement _emptyView;
View _formsEmptyView;

protected ItemsViewRenderer()
{
AutoPackage = false;
}

protected TItemsView ItemsView => Element;
protected ItemsControl ItemsControl { get; private set; }

Expand Down

0 comments on commit 43b0607

Please sign in to comment.