How to create content rotator/slider in WPF using ItemsControl?
My goal is to create a content slider with WPF similar to what is widely available using JQuery. An example is the Moving b开发者_JS百科oxes script: Moving Boxes
I've been searching, but it's hard to find when WPF has a control called Slider, and Rotator is usually referencing animation. I've tried using a horizontal stackpanel inside of a custom animated scrollviewer to little success. So any ideas are appreciated.
UPDATE: I was able to accomplish this functionality by creating a custom ScrollViewer control with dependency properties added to enable animation of the scrolling via events. I used this project as inspiration:Animate WPF ScrollViewer on Codeplex
I done something similar to this a while ago but I haven't got the code anymore.
I am sure I used a listview on a stackpanel with horizontal orientation and you are able to hide the scroll bar so it just looks like a plain list.
You can then create two controls for scrolling left or right and when either is pressed just call the scrollIntoView method of the Listview object.
Hope this helps a bit.
Here's a link on the subject http://blog.pixelingene.com/2008/06/a-carousel-view-for-elementflow/ it's a 3d control but it can give you some ideas
精彩评论