Walkthrough: Implementing SnapView in Your Windows 8 App
Join the DZone community and get the full member experience.Join For Free
there are four supported orientations in windows 8. there is full view, snap view, fill view and portrait view. each is important in the overall strategy of windows 8. in order to get your app into the windows store, you must support the full, snap and fill view. and to support them, xaml uses viewstates that easily execute custom animations and show your tailored content.
the different views in windows are something developers have to deal with but are fundamentally one of windows 8’s core differentiators in the marketplace. since a windows 8 is only active when it is visible it means that only one app can run at a time – similar to the ipad. but because of snapview, windows 8 allows users to view more than one app at a time, even if the second app is in a narrow format. as a result, the user can enjoy more than one app at a time, increasing the opportunity for productivity.
the image above shows the full, snap, and fill view on a slate device, respectively. it is an important note to say that snap is not a touch-only mechanism. i run on a desktop that has no touch input. i use snap. it allows me to have more than one windows 8 app up at one time. it also allows me to have a desktop app and a windows 8 app running at the same time. it’s nice.
the core resolution of windows 8 is 1366 x 768. this is a beautiful 16:9 resolution just like your hd television at home. it makes windows 8 an ideal platform for consuming like television and movies. snapping, however, splits that resolution. the fillview becomes a traditional 1024 x 768 (a resolution most developers are accustom to). the snapview becomes 320 x 768 (a resolution mysteriously similar to windows phone). the three resolutions reveal themselves to be thoughtfully designed and quite useful to in app design efforts.
store certification requirements
here’s how it reads :
3.6 your app must use the mechanisms provided by the system for those features that have them
your app must support a snapped layout. in landscape orientation, your app’s functions must be fully accessible when the app’s display size is 1024 x 768. your app must remain functional when the customer snaps and unsnaps the app.
as a personal aside, it is interesting to consider what it means to support the snapview. if you look at solitaire, it reorients the cards to a vertical orientation when snapped. if you look at the windows store, it shows only a static logo when snapped. both support snapview. what does that mean your app needs to do to support snapview? well, it depends.
supporting snapview in xaml
xaml supports snapview by leveraging the viewstates. in the video below, i’ll show you the basic implementation on supporting every windows 8 orientation view.
and, there you go! if i can do it with a stuffy nose, you can support snap, too!
best of luck!
Published at DZone with permission of Jerry Nixon, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.