How to get X and Y coordinate of a listview item?

HarshitaHarshita INMember ✭✭✭✭
edited March 2018 in Xamarin.Forms

I want X and Y coordinate of a litview item.so to get this in xamarin forms?

Answers

  • JohnHardmanJohnHardman GBUniversity mod

    @Harshita - See https://forums.xamarin.com/discussion/comment/324303/#Comment_324303 (although that has what looks like one or more copy/paste errors at the moment).

  • HarshitaHarshita INMember ✭✭✭✭

    I want that animation,after select any list item then a box flying to center top screen

    how to do this?

  • JohnHardmanJohnHardman GBUniversity mod

    @Harshita - See

  • sonic1015sonic1015 CAMember ✭✭

    From the other post...

    In the different platforms, you can get the Renderer, which holds the Native View. From there, you can get the Screen coordinates. This does work in a Listview, I've used it myself. To get the Native Views:

    iOS:

    Xamarin.Forms.Platform.iOS.Platform.GetRenderer(myVisualElement).NativeView;
    

    Android:

    Xamarin.Forms.Platform.Android.Platform.GetRenderer(myVisualElement).View;
    

    UWP:

    Xamarin.Forms.Platform.UWP.Platform.GetRenderer(myVisualElement).FrameContainer;
    

    From there, you can get the screen coordinates on each platform. It may be helpful to get the native root view for some platforms.

Sign In or Register to comment.