So I have looked over this and have come up with a couple solutions which I am unable to test yet. Let me explain.
I am trying to figure out how to code a program where I have an array of images, where only one image is shown at a time, but the adjacent images are preloaded but not visible. After each flick, the now current image animates itself over to the visible area, and the adjacent images are updated, but not visible until the next flick in either direction. I only want to have 3 'boxes' (if you will), consisting of the image to the left, current image on screen, and the image to the right. If revolving to the right, the current image becomes the left image, the image to the right becomes the current image, and the next image is preloaded but not visible.
Example:
First image you see is when the app is loaded. It's essentially the first image in the array. Call it (Image 1).
You cannot flick to the left, as no image is there. But the image to the right of it (not visible yet) is already preloaded and ready to slide when the flick is registered. (image 2)
So if we flick to the right, Image 1 is to the left of the now visible and centered Image 2. Image 3 is now to the right, not visible but preloaded. Image 开发者_运维百科1 is now to the left, not visible but preloaded.
I only want to have 2 things preloaded now, so you can imagine 3 slots. One slot is the left picture. One slot is the current view, and one slot on the right.
The idea is to be able to have a carousel of images, but only preloading the images to the left and right of the current view.
I looked at possibly doing a listbox. The thing is, is that I just can't code the animation in c#.
I'm not wanting you to code this for me, but to point me in a right direction.
you can use a Pivot control for this, it works exactly like you want, except it does loop around to the start of the list.
You can just create dynamic pivot items on the fly, I have done this and it works.
EDIT
Some sample code:
PivotItem p = new PivotItem();
Image i = new Image();
i.Source = new BitmapImage(new Uri("/image.jpg", UriKind.Relative));
p.Content = i;
MainPivot.Items.Add(p);
Assuming MainPivot
is your Pivot in your view, if you dont have one, just create a new instance of one and add it to your scene.
精彩评论