locked
circular scroll viewer RRS feed

  • Question

  • How can I implement circular scroll viewer in a metro app ? I want to have a page with some items arranged horizontally. Now when I scroll, the items should move in a circular fashion. Means when I reach the last item then it should come back to the first items and so on. I want it to be done in C# and XAML.
    Monday, April 22, 2013 12:50 PM

Answers

  • You can use the ScrollViewer.ViewChanged method to find where the current offsets through which you can determine whether you have reached the "last item" on your list. At this time, use ScrollViewer.ScrollToHorizontalOffset method with a target HorizontalOffset of 0 to make the ScrollViewer go back to the first item.

    Harini Kannan | Program Manager, XAML

    Thursday, April 25, 2013 9:53 PM
  • I have developed a few custom circular scroll viewers and they are hard to develop.

    However I found this link that will help you do the job:
    http://blogs.msdn.com/b/mim/archive/2013/04/16/winrt-create-a-custom-itemspanel-for-an-itemscontrol.aspx

    It contains explanations, source codes, videos and pictures how to achieve this.
    There is also a full source available at the bottom of the page.

    Even if it is not what you need, it is a great article and you should read it.

    Monday, April 29, 2013 8:49 AM

All replies

  • You'll have to write your own, there isn't a control that does this out of the box.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    • Proposed as answer by Aaron Xue Wednesday, April 24, 2013 8:36 AM
    Monday, April 22, 2013 3:13 PM
    Moderator
  • can somebody help me with the code !!
    Tuesday, April 23, 2013 4:08 AM
  • You can use the ScrollViewer.ViewChanged method to find where the current offsets through which you can determine whether you have reached the "last item" on your list. At this time, use ScrollViewer.ScrollToHorizontalOffset method with a target HorizontalOffset of 0 to make the ScrollViewer go back to the first item.

    Harini Kannan | Program Manager, XAML

    Thursday, April 25, 2013 9:53 PM
  • I have developed a few custom circular scroll viewers and they are hard to develop.

    However I found this link that will help you do the job:
    http://blogs.msdn.com/b/mim/archive/2013/04/16/winrt-create-a-custom-itemspanel-for-an-itemscontrol.aspx

    It contains explanations, source codes, videos and pictures how to achieve this.
    There is also a full source available at the bottom of the page.

    Even if it is not what you need, it is a great article and you should read it.

    Monday, April 29, 2013 8:49 AM