Disable packager for CollectionView on UWP (#8404)

* Reproduce issue 8366

* Clean up old comments

* Turn off packaging for the CollectionView on UWP
Fixes #8366
This commit is contained in:
E.Z. Hart 2019-11-18 02:19:50 -07:00 коммит произвёл Gerald Versluis
Родитель e640a19542
Коммит 43b06078d8
4 изменённых файлов: 102 добавлений и 5 удалений

Просмотреть файл

@ -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;
}
}
}

Просмотреть файл

@ -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" />

Просмотреть файл

@ -125,10 +125,6 @@ namespace Xamarin.Forms
BindableProperty.Create(nameof(ItemsLayout), typeof(IItemsLayout), typeof(ItemsView),
LinearItemsLayout.Vertical);
// public abstract IItemsLayout ItemsLayout { get; }
protected IItemsLayout InternalItemsLayout
{
get => (IItemsLayout)GetValue(InternalItemsLayoutProperty);
@ -144,7 +140,6 @@ namespace Xamarin.Forms
set => SetValue(ItemSizingStrategyProperty, value);
}
public static readonly BindableProperty ItemTemplateProperty =
BindableProperty.Create(nameof(ItemTemplate), typeof(DataTemplate), typeof(ItemsView));

Просмотреть файл

@ -26,6 +26,11 @@ namespace Xamarin.Forms.Platform.UWP
FrameworkElement _emptyView;
View _formsEmptyView;
protected ItemsViewRenderer()
{
AutoPackage = false;
}
protected TItemsView ItemsView => Element;
protected ItemsControl ItemsControl { get; private set; }