Windows Phone 7 图像循环
我想循环浏览一系列图像。我尝试过使用枢轴控件,但我不喜欢图像转换之间的空白。我更喜欢使用能够在图像之间平滑地动画的东西。我还查看了 LoopingSelector 控件,但我似乎无法将方向设置为水平。
I would like to loop through a sequence of images. I have tried using a Pivot control, but I don't like the blank space in between image transitions. I would prefer to use something that will animate between images smoothly. I also looked at the LoopingSelector control, but I can't seem to set the orientation to horizontal.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我假设您对 iOS 提供的一种图像查看器感兴趣,可以通过向右或向左滑动来浏览照片。如果是这样的话,我不想这么说,但我认为你正在考虑建立自己的控制。
我认为要正确实现它,这些是您需要考虑和解决的基本问题:
出于性能考虑,将您拥有的所有图像加载到内存流对象中并存储二进制数据(您可以对此发挥创意,并且只能存储前 10-15 个图像,具体取决于图像的大小,这样做将使您的控件能够支持数千个图像,并且仍然表现得像冠军一样)。
一旦图像大约出现在屏幕上,将图像的源设置为已加载字节的已保存内存流对象(这将最大限度地减少 UI 线程所做的工作,保持控件的性能和响应能力)
使用操纵事件来跟踪某人在从左向右滑动时使用的动作的 delta x,以便实际执行项目的移动
通过更改图像的 Canvas.Left 属性来移动图像(我认为你可以使用负值,否则只需使画布的宽度等于你组合的所有图像的宽度)< /p>
查找一些可用的库来支持动量,以便您可以拥有自然的效果图像之间的平滑过渡
I'm assuming you're interested in a kind of image viewer like iOS offers, swiping right or left to navigate through the photos. If that's the case, I hate to say it but i think you're looking at building your own control.
I think to implement it properly these are the essential things you need to think about and address:
For performance' sake, load all the images you have into memorystream objects and store the binary data (you can get creative with this and only store the first 10-15 images, depending on how large the images are, doing this would enable your control to support thousands of images and still perform like a champ).
Once an image is about to be on-screen set the source of the image to the saved memorystream object that has the bytes loaded into it (this will minimize the work that the UI thread does, keeping the control performant and responsive)
Use Manipulation events to track the delta x of the motion someone uses when swiping left to right in order to actually perform the moving of the items
Move the images by changing their Canvas.Left property (you can go negative I think, otherwise just make your canvas the width of all the images you have combined)
Look up some of the available libraries to support momentum so you can have a natural smooth transition between images