Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9149445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:28:41+00:00 2026-06-17T11:28:41+00:00

When moving through items in an ItemsControl or ScrollViewer , can I loop the

  • 0

When moving through items in an ItemsControl or ScrollViewer, can I loop the contents so that the first item comes “after” the last item (as perceived by the user)?

I have a custom ScrollViewer that will animate between selections, which currently contains an ItemControl. The XAML for setting up my control is as follows:

<local:AnimatedScrollControl x:Name="myScroll" Grid.Column="1" VerticalScrollBarVisibility="Hidden" HorizontalScrollBarVisibility="Hidden">
    <ItemsControl x:Name="myList"
                    ItemsSource="{Binding SlidesList}"
                    ItemTemplate="{StaticResource SlideTemplateOne}"
                    VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling">
        <ItemsControl.ItemsPanel>
            <ItemsPanelTemplate>
                <VirtualizingStackPanel Orientation="Horizontal" />
            </ItemsPanelTemplate>
        </ItemsControl.ItemsPanel>
    </ItemsControl>
</local:AnimatedScrollControl>

Each item in the ItemControl takes up the entire visible area for the control, so the user only sees one item at a time. The image below represents the control in action, with the red box indicating the viewport. A timer moves to the next item automatically.
Control Example 01
The code to shift the slides (simplified for brevity) currently looks like this:

private void NextSlide()
{
    _currentSlide++;

    // get the current offset
    double offset = (double)myScroll.GetValue(AnimatedScrollControl.SlideOffsetProperty);

    // get the width of the current slide
    FrameworkElement elementContainer = myList.ItemContainerGenerator.ContainerFromItem(CurrentSlide) as FrameworkElement;

    // set the `to` value for a single slide shift
    double to = offset + elementContainer.ActualWidth;

    if (_currentSlide == _items.Count)
    {
        to = 0;
        _currentSlide = 0;
    }

    DoubleAnimation animation = new DoubleAnimation();
    animation.EasingFunction = new CubicEase { EasingMode = EasingMode.EaseOut };

    animation.From = offset;
    animation.To = to;
    animation.Duration = TimeSpan.FromMilliseconds(300);

    myScroll.BeginAnimation(AnimatedScrollControl.SlideOffsetProperty, animation);
}

When the last slide is reached and the viewport is updated to the first slide, it scans all the slides in reverse to reach the beginning. Like so:
Control Examples 02
What I would like to do is make it appear as if the viewport scan directly from ‘Slide 5’ to ‘Slide 1’, such as:
Control Examples 03

Is there a way I can set up my ItemsControl or ScrollViewer, or adjust my Animation in order to achieve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T11:28:42+00:00Added an answer on June 17, 2026 at 11:28 am

    My solution came in the form of using an old LoopFrame class, written by Dr WPF.

    http://drwpf.com/blog/2009/08/05/itemscontrol-n-is-for-natural-user-interface/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The Apple Human Interface Guidelines state that : An item that provides click-through is
Moving through the maze forward is pretty easy, but I can't seem to figure
I have some templates that look roughly like this: <template name=items> <div class=item-list> {{#each
I've created a custom table where I can scroll through a list of items
When moving to Spring 2.5.x I found that it adds more stereotype annotations (on
After moving to the new server, I'm getting plenty of such notifications: A PHP
I'm trying the moving limit after zoom with canvas scale, but new coordinates does
I wanted to add some Overlay items to MapsForge at runtime; I can successfully
I have a .net windows service that works it's way through a queue of
I'm looping through an array of items nested within another array of items. Almost

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.