Bug 60033 - ListView override void SetupContent not triggered in UWP
Summary: ListView override void SetupContent not triggered in UWP
Status: CONFIRMED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms (show other bugs)
Version: 2.4.0
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-10-06 18:10 UTC by Andrew
Modified: 2018-02-23 15:18 UTC (History)
3 users (show)

Tags: listview, setupcontent, 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 60033 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 Andrew 2017-10-06 18:10:18 UTC
Hi there! -

I've struggling with the following. When trying to extend the ListView and overriding the SetupContent()

    public class ListViewExt : ListView
    {
        protected override void SetupContent(Cell cell, int index)
        {
            base.SetupContent(cell, index);

    
        }
    }

This does not get trigger in a UWP project, however on iOS it works fine. What I'm missing here?
Here's the link to the sample project to illustrate. Any guidance on this is much appreciated.

https://gsiccorp-my.sharepoint.com/personal/ancotterell_gsiccorp_net/_layouts/15/guestaccess.aspx?docid=1ca22a7b9d62c4c2f853803dab67da7b1&authkey=AQZ8s3AyfuJRJ6Ue16yDgtU&expiration=2017-11-05T18%3a00%3a12.000Z
Comment 1 Paul DiPietro [MSFT] 2017-10-06 19:26:01 UTC
I think there are some inconsistencies in behavior. Adding a reference to 45689.
Comment 2 Andrew 2017-10-11 19:08:23 UTC
is there a suggested work around as this being looked at? Or do we anticipate a resolution soon?
Comment 3 Paul DiPietro [MSFT] 2017-10-25 22:41:38 UTC
Try this for the time being:

		public class CustomListView : ListView
		{
			public CustomListView() : base()
			{
				TemplatedItems.CollectionChanged += TemplatedItems_CollectionChanged;
			}

			protected override void SetupContent(Cell cell, int index)
			{
				base.SetupContent(cell, index);
			}

			void TemplatedItems_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
			{
				foreach (var item in TemplatedItems)
					Noop();
			}

			void Noop() { }
		}
Comment 4 Andrew 2017-10-27 17:53:26 UTC
Great... this worked! Much appreciated
Comment 5 Paul DiPietro [MSFT] 2017-10-30 18:30:49 UTC
https://github.com/xamarin/Xamarin.Forms/pull/1240
Comment 6 E 2017-11-17 15:08:52 UTC
@Paul DiPietro

If I implement your workaround, i'm getting the following error

- Unable to cast object of type 'XFLetsGrowApp.UWP.CustomListView' to type 'Xamarin.Forms.IRegisterable'."	string