Scrolling to a randomly selected item?

8 posts, 1 answers
  1. Craig
    Craig avatar
    7 posts
    Member since:
    Jun 2009

    Posted 07 Oct 2011 Link to this post

    Hello,

       I have a List of just over 100 items and I have a button that randomly selects one of the items.  Using the built-in list box I would just call "list.ScrollIntoView(list.Items[i])" and it would, well, scroll into view.  How do I do this in a DataBoundListBox?

    Craig.
  2. Answer
    Deyan
    Admin
    Deyan avatar
    2041 posts

    Posted 07 Oct 2011 Link to this post

    Hi Craig,

    Thanks for contacting us and for your question. You can use the BringIntoView method of RadDataBoundListBox to achieve the same.

    Let me know if you need further assistance with this.

    Regards,
    Deyan
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
  4. Craig
    Craig avatar
    7 posts
    Member since:
    Jun 2009

    Posted 07 Oct 2011 Link to this post

    Yeah, that worked just like advertised.  Of course, now that I look at it, it isn't very Metro.  Is there a way to make it animate from one selection to another?  Perhaps with a little bounce at the end?  That would be awesome. :)

    Thanks!!

  5. Deyan
    Admin
    Deyan avatar
    2041 posts

    Posted 07 Oct 2011 Link to this post

    Hello Craig,

    Thanks for writing back.

    Currently, there is no an out-of-the-box way to animate what BringIntoView does. However, with the Q3 version of our suite we will provide support for item animations in RadDataBoundListBox. I believe that with this functionality you could bring some freshness to your app. Make sure to follow our blogs where we will officially announce all new features and will make demonstrations.

    Do not hesitate to write back in case you have further questions or need assistance.

    Best wishes,
    Deyan
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  6. Jandieg
    Jandieg avatar
    43 posts
    Member since:
    Feb 2012

    Posted 31 Jan 2014 Link to this post

    Can it be done animated if item is in viewport?
  7. Jandieg
    Jandieg avatar
    43 posts
    Member since:
    Feb 2012

    Posted 31 Jan 2014 in reply to Jandieg Link to this post

    Jandieg said:Can it be done animated if item is in viewport?


    Edit: just tried this and works:
    var scroll = lst.ChildrenOfType<ScrollViewer>().First();
    scroll.ScrollToHorizontalOffset(x);

    It should work for an animation by looping ScrollToHorizontalOffset. Or is there an optimal way?
  8. Deyan
    Admin
    Deyan avatar
    2041 posts

    Posted 05 Feb 2014 Link to this post

    Hi Jandieg,

    Thanks for writing back.

    You can use this approach but you will have to make sure to trigger the UI virtualization logic as well. But since we do not support it officially, we do not guarantee you that it will flawlessly work.

    Regards,
    Deyan
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peek previews directly from the developers working on the UI for Windows Phone, subscribe to the blog feed now.
  9. Jandieg
    Jandieg avatar
    43 posts
    Member since:
    Feb 2012

    Posted 11 Feb 2014 in reply to Deyan Link to this post

    Yes it actually not smooth. If anyone knows a better workaround or has a sample please share.
Back to Top
DevCraft banner