ScrollTo (object item, object group, Xamarin.Forms.ScrollToPosition position, bool animated)

MuhiMuhi Member ✭✭

Has any one gotten this to work?
I'm trying to scroll to a cell in my view list with no luck.
I have view cells that are you using templates and they are grouped nothing else.
Thanks for any help..

Best Answers

Answers

  • MuhiMuhi Member ✭✭

    @AlessandroCaliaro
    Are you using a grouped list with Templates?
    I narrow down my item object that the cells binding to down to the one I want to scroll to and I pass that item in to the item object and the group objet st my scroll position to Makevisible and false. and the list view just comes up with out moving to the cell I passed in..

  • MuhiMuhi Member ✭✭

    @AlessandroCaliaro
    If you have a little snippet that might help..
    Thanks

  • MuhiMuhi Member ✭✭

    @LandLu
    Thanks for the sample I will take a look.
    Based off of what you are saying I think I'm passing in the correct item.

    If you have a min could you take a quick look at my logic .. Thanks

    So my listview is a calendar grouped by date and has a list of tasks under each date.
    For now I have a button that calls the code behind to go to current date.

    I get the items from my ItemsSource
    var items = CalTaskView.ItemsSource.Cast<ViewListGrouping<CalGroupViewHeader, ScheduleTaskData>>();

    Then I loop over the items to get the item I want based off of the date
    Then I call the ScrollTo with
    The item I wanted. This will contain a list of Task objects that are displayed under the group.
    The item.Key this is the the group that contains the list of items

    foreach (var item in items)
    {

                if (item.Key.FlightDate == "The date I want")
                {
            CalTaskView.ScrollTo(item, item.Key, ScrollToPosition.MakeVisible, false);
        }
        }
    
  • MuhiMuhi Member ✭✭

    @LandLu
    I got it working thanks so much for your help
    Thanks,
    Mo

Sign In or Register to comment.