简体   繁体   中英

WP8 Photo Viewer similar to the one used by the Photos App

I am working on an app which has an album of photos. I want the user to be able to click one of them to bring up a page to watch/zoom/etc them seperately, exactly like it works in the Photo App and in the Store app.

I have been experimenting with a scrollviewer and a vertical stackpanel but I can't figure out how to make it work as intended. What am I missing?

Well I would think it should be possible to use a pivot control, because this comes with the swiping feature for free! Only thing to do is loading the images in a dynamic way, because preloading them all will eat up to much memory.

For the zooming, there are several solutions to be found on the internet ( like this one... ) but the trick is to keep track of the initial zoom loading state of the image. Because as long as you are in that state, the user must be able to use the swipe of the pivot. If you are not in the initial zoom loading state, you must lock the current pivot! ( wp8 pivot has this build in with the property isLocked for wp7 you can use this... )

The get a headerless pivot, just put an empty datatemplate in the headertemplate:

  <controls:Pivot.HeaderTemplate> <DataTemplate /> </controls:Pivot.HeaderTemplate> 

Take a look at this Basic Lens sample . You don't need the camera functionality, but it's being hosted in a control very similar to the photos app from the MediaViewer library project. The only thing it's missing is the most zoomed out view, which you should be able to add yourself as a StackPanel in a ScrollViewer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM