HTML and CSS Reference
In-Depth Information
The label with the text “I'm snapped now!” is not visible anymore. This is because the window is
forced to a fixed width and the text—right-aligned after the last changes—doesn't fit anymore in the
available space.
This example raises a few rendering problems that you can fully address only by giving your
application an adaptive layout.
Towards an adaptive layout
When it comes to snapped and filled views, the bottom line is that users can snap any applications.
Your application can adapt to the snapped view, but it can't prevent snapping from happening. If
the application is not designed with snapping in mind, then its area is forcedly resized and this might
cause some content to be cropped off, as in Figure 8-8.
General principles of snapped and filled views
Generally speaking, all Windows Store applications should abide by a few guidelines for snapped and
filled views. There might be scenarios and situations in which this is not entirely possible. However,
every effort should be put forth to work out a layout that seamlessly adapts to any size. Here are the
principles at the foundation of the snapped view in Windows 8.
Be aware of view changes
Any Windows Store application should always register a handler for the resize event of the host
window. This ensures that any application can properly react to any view changes that are reckoned
significant. In the previous exercise, you just checked this principle off.
parity of features across states
Ideally, you should have just one application that provides some uniform behavior across the possible
view states. Whenever possible, the application should expose 100 percent of its functionality regard-
less of the view state—whether snapped, filled, landscape, or portrait.
In practice, though, this principle isn't the law and needs some elastic interpretation. What if your
application needs to display a large input form? What if the application displays large data items like
videos or photos? Both videos and photos can be shrunk to some extent, but the resulting quality
may or may not be ideal for the purposes of the application.
Unsnap with care
If parity of features is not something you can guarantee, then you should consider unsnapping the
application programmatically when the user selects one of the critical functions. As an example,
consider a to-do list application.
Search WWH ::

Custom Search