23.01.2018 Views

MICROSOFT_PRESS_EBOOK_PROGRAMMING_WINDOWS_8_APPS_WITH_HTML_CSS_AND_JAVASCRIPT_PDF

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Within the body of content, then, Windows app design encourages these layout principles:<br />

• Let content flow from edge to edge.<br />

• Keep ergonomics in mind: pan along the long edge of the view (primarily horizontal in<br />

landscape views, vertical in snapped view and possibly portrait).<br />

• Pan on a single axis only to create a sense of stability and to support swiping to select (as with<br />

the ListView controls), or employ rails to limit panning directions to a single axis.<br />

• Create visual alignment, structure, and clarity with the Windows 8 silhouette, aligning elements<br />

on a grid for consistency. Refer again to Laying out an app page. This shape is what allows a<br />

consumer’s eyes to recognize something as a Store app without having to think about it, which<br />

provides a feeling of familiarity and confidence.<br />

As I’ve mentioned before, the project templates in Visual Studio and Blend have these principles<br />

baked right in and thus provide a convenient starting point for apps. Even if you start with the Blank<br />

App template, the others like the Grid App will serve as a reference point. This is exactly what we did<br />

with the Here My Am! app in Chapter 2, “Quickstart.”<br />

The other important guiding principle that’s relevant to layout is “snap and scale beautifully.” This<br />

means making sure you design every page in your app to handle all four view states and to be<br />

appropriately adaptive across different display resolutions and pixel densities. We’ll look at this subject<br />

in the “View States and the Many Faces of Your Display” section below. First, however, let’s look at a<br />

little piece of core layout code.<br />

Quickstart: Pannable Sections and Snap Points<br />

In Chapter 5, “Collections and Collection Controls,” we spent a little time looking at when a ListView<br />

control was the right choice and when it wasn’t. One of the primary cases where developers have<br />

inappropriately attempted to use a ListView is to implement a home or hub page that contains a variety<br />

of distinct content groups arranged in columns, as shown in Figure 6-4 and explained on Navigation<br />

design for Windows Store apps. At first glance this might look like a ListView, but because the data it’s<br />

representing really isn’t a collection, just a layout of fixed content, it makes sense to use tried-and-true<br />

<strong>HTML</strong> and <strong>CSS</strong> for the job!<br />

I point this out because with all the great controls that WinJS provides, it’s easy to forget that<br />

everything you know about <strong>HTML</strong> and <strong>CSS</strong> still applies in Store apps. After all, those controls are in<br />

themselves just blocks of <strong>HTML</strong> and <strong>CSS</strong> with some additional methods, properties, and events.<br />

237

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!