Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Using a StoryBoard to "slowely" scroll from one item to another in an ItemsControl

$
0
0

Hi, as the title suggests, I wanted to slowley scroll from one item to the next in an items control (and then at the end I will star over again - for ever)

I almost have this working, after finding a suggestion on using a helper that allows us to create a binding that will call the ScrollToVerticleOffset on a ScrollViewer.

The code for my sample can be obtained from

https://dl.dropboxusercontent.com/u/30760237/ScrollTest.zip

So, in here I am using a DoubleAnimation, and I am binding the From and the To to properties, so I can increment these to scroll to each successive item

IF you run, and look at the ouput window (for the tracing), we can see that the first time we click the button, we get the viewer scrolling smoothely to the next item, just as I want.

However, once I up date the To and the From...

 From = To;
 To = From += 54;
 PropertyChanged(this, new PropertyChangedEventArgs("From"));
 PropertyChanged(this, new PropertyChangedEventArgs("To"));     

The next time we call the board.Begin(), the offset value just straight from the From Value to the To.. in the tracing we don't see all the intermediate values. It has something to do with updating the From and the To (if you remove these updates, then it works smoothley each time (it just jump back to the first item each time)

Does anyone know why updating this From and To values on the StoryBoard stop it working, and if so a way to fix it?

Thanks heaps in advance for any help,

regards, Peter



Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>