Bahadir Gul
Bahadir Gul

Reputation: 150

How To Get Children of Xamarin Forms Listview

I currently developing a listview in Xamarin.

In every cell i got a scrollView and i am trying to scroll each of them same amount when one of them scrolled.

And i trying to get all scrollviews in children of listview and scroll them any scroll event triggered.

Or is there any other way to do this.

Upvotes: 0

Views: 1213

Answers (1)

Krumelur
Krumelur

Reputation: 33048

I'm not sure why you would want to do something like this (embedding scrolling containers into already scrolling ones is generally discouraged), but you made me think about a possible approach. :-)

Cells of a ListView are being generated dynamically. I'd probably use the messaging service. You can send out a message about the position you'd like all of your cells to scroll to like this:

MessagingCenter.Send<ViewCell, float> (this, "ScrollPosChanged", currentScrollPos);

and then subscribe in your custom cells:

MessagingCenter.Subscribe<ViewCell, float> (this, "ScrollPosChanged", (sender, arg) => {
  // Scroll this cell's scrollview.
});

Upvotes: 3

Related Questions