Forum Xamarin.Forms

ListView: Get the actual list of the displayed Cells

David.RettenbacherDavid.Rettenbacher ATMember ✭✭
edited April 2016 in Xamarin.Forms

Tested with:

  • Xamarin.Forms 2.2.0-pre2 - 2.2.0-pre4
  • Universal Windows Application


I'm trying to get the rendered children of a ListView. With reflection I found that only TemplatedItems holds a filled list of Cells.

The problem is that these Cells are NOT the ones displayed on the screen(!?)

In my case I have a Label in the Cell-template to tap on it.
If I add a gesture-handler and tap on the Label and look at the Element handed over to the handler, the id is different from any ids i get from TemplatedItems! (Also the Cell-Ids)
If I set something like TextColor on the Label in the gesture-handler it gets visible on the screen.
If I set it on the Label via the TemplatedItems-list, nothing happens, although reading the values right after writing to it (in the same handler-method) returns the right previously set values.

It seams to me that by getting TemplatedItems it creates a copy and hands it to me.

How can I get the actual Cells displayed?

Sign In or Register to comment.