Creating a Page Control

A Page control, as its name suggests, enables you to create a control from a page. A Page control provides you with an easy method of creating custom WinJS controls. When you create a Page control, you create a new WinJS control out of an HTML page, JavaScript file, and CSS file.

Creating a new Page control makes sense when you need to do more than simply add a chunk of HTML to a page. A Page control enables you to encapsulate both appearance and behavior in a control.

Furthermore, a Page control has its own event lifecycle. For example, a Page Control has its own ready event which you can handle to initialize the control.

Imagine, for example, that you want to create an Alert control. When someone clicks the button rendered ...

Get Windows® 8.1 Apps with HTML5 and JavaScript Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.