Bug 59018 - ListView with RowHeight specified, contained in horizontal ScrollView, throws exception
Summary: ListView with RowHeight specified, contained in horizontal ScrollView, throws...
Status: CONFIRMED
Alias: None
Product: Forms
Classification: Xamarin
Component: Windows ()
Version: 2.4.0
Hardware: PC Windows
: Normal major
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-08-24 16:15 UTC by John Hardman
Modified: 2017-08-24 20:17 UTC (History)
3 users (show)

Tags: ListView, ScrollView, RowHeight, UWP, ac
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 59018 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
CONFIRMED

Description John Hardman 2017-08-24 16:15:53 UTC
On UWP, a ListView contained in a horizontal ScrollView works as expected. However, specifying a RowHeight on the ListView results in the ScrollViewRenderer throwing an exception that blows the app away.

The same scenario works fine on other platforms.

The exception on UWP is:

Exception message = System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
   at Windows.UI.Xaml.UIElement.Measure(Size availableSize)
   at Xamarin.Forms.Platform.UWP.VisualElementRenderer`2.MeasureOverride(Size availableSize)
   at Windows.UI.Xaml.UIElement.Measure(Size availableSize)
   at Xamarin.Forms.Platform.UWP.ScrollViewRenderer.MeasureOverride(Size availableSize)
   at Windows.UI.Xaml.UIElement.Measure(Size availableSize)
   at Xamarin.Forms.Platform.


This looks to be related to bug 52349 which was closed as invalid as ListViews are not supposed to be used in vertical ScrollViews. However, there should be no reason why a ListView could not be used in a horizontal ScrollView.

To reproduce, just pop the following into a ContentPage:

                List<Person> people = new List<Person>
                {
                    new Person("Abigail", new DateTime(1975, 1, 15), Color.Aqua),
                    new Person("Bob", new DateTime(1976, 2, 20), Color.Black),
                    new Person("Cathy", new DateTime(1977, 3, 10), Color.Blue),
                    new Person("David", new DateTime(1978, 4, 25), Color.Fuschia),
                    new Person("Eugenie", new DateTime(1979, 5, 5), Color.Gray),
                    new Person("Freddie", new DateTime(1980, 6, 30), Color.Green),
                    new Person("Greta", new DateTime(1981, 7, 15), Color.Lime),
                    new Person("Harold", new DateTime(1982, 8, 10), Color.Maroon),
                    new Person("Irene", new DateTime(1983, 9, 25), Color.Navy),
                    new Person("Jonathan", new DateTime(1984, 10, 10), Color.Olive),
                    new Person("Kathy", new DateTime(1985, 11, 20), Color.Purple),
                    new Person("Larry", new DateTime(1986, 12, 5), Color.Red),
                    new Person("Monica", new DateTime(1975, 1, 5), Color.Silver),
                    new Person("Nick", new DateTime(1976, 2, 10), Color.Teal),
                    new Person("Olive", new DateTime(1977, 3, 20), Color.White),
                    new Person("Pendleton", new DateTime(1978, 4, 10), Color.Yellow),
                    new Person("Queenie", new DateTime(1979, 5, 15), Color.Aqua),
                    new Person("Rob", new DateTime(1980, 6, 30), Color.Blue),
                    new Person("Sally", new DateTime(1981, 7, 5), Color.Fuschia),
                    new Person("Timothy", new DateTime(1982, 8, 30), Color.Green),
                    new Person("Uma", new DateTime(1983, 9, 10), Color.Lime),
                    new Person("Victor", new DateTime(1984, 10, 20), Color.Maroon),
                    new Person("Wendy", new DateTime(1985, 11, 5), Color.Navy),
                    new Person("Xavier", new DateTime(1986, 12, 30), Color.Olive),
                    new Person("Yvonne", new DateTime(1987, 1, 10), Color.Purple),
                    new Person("Zachary", new DateTime(1988, 2, 5), Color.Red)
                };

                ListView listView = new ListView
                {
                    RowHeight = 200,
                    ItemsSource = people,
                    ItemTemplate = new DataTemplate(() =>
                    {
                        BoxView boxView = new BoxView
                        {
                        };
                        boxView.SetBinding(BoxView.ColorProperty, "FavoriteColor");
                        return new ViewCell
                        {
                            View = new StackLayout
                            {
                                Margin = 0,
                                Orientation = StackOrientation.Horizontal,
                                Children =
                                {
                                    boxView
                                }
                            }
                        };
                    })
                };

                this.Content = new ScrollView
                {
                    Orientation = ScrollOrientation.Horizontal,
                    BackgroundColor = Color.Pink,
                    Content = listView,
                };
Comment 1 Paul DiPietro [MSFT] 2017-08-24 20:17:17 UTC
I will set this to confirmed for now until we can get this further investigated; the issue is still apparent on the 2.4.1-nightly feed.