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.

The scenario also sets up a listener for click events on the TOC entries, the handler for which flips to<br />

the appropriate item by setting the FlipView’s currentPage property. The picture items then have a back<br />

link to the TOC. See the clickHandler function in the code for both of these actions.<br />

Scenario 4 (“Creating a context control”) demonstrates adding a navigation control overlay to each<br />

item:<br />

The items themselves are again rendered using a declarative template, which in this case just<br />

contains a placeholder div called ContextContainer for the navigation control (html/context-<br />

Control.html):<br />

<br />

<br />

<br />

<br />

<br />

When the control is initialized in the processed method of js/contextControl.js, the sample calls the<br />

FlipView’s async count method. The completed handler, countRetrieved, then creates the navigation<br />

control using a row of styled radiobuttons. The onpropertychange handler for each radiobutton then<br />

sets the FlipView’s currentPage property.<br />

Scenario 4 also sets up listeners for the FlipView’s pageselected and pagevisibilitychanged events.<br />

The first is used to update the navigation radiobuttons when the user flips between pages. The other is<br />

used to prevent clicks on the navigation control while a flip is happening. (The event occurs when an<br />

item changes visibility and is fired twice for each flip, once for the previous item, and again for the new<br />

one.)<br />

Scenario 5 (“Styling Navigation Buttons”) demonstrates the styling features of the FlipView, which<br />

involves various win-* styles and pseudo-classes as shown here:<br />

200

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

Saved successfully!

Ooh no, something went wrong!