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.

If you drag and drop that control onto an <strong>HTML</strong> page, you’ll then see the different bits added in:<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

But wait! What happened to the WinJS.UI.processAll() call that the XML indicated a script tag in<br />

the header? It just so happens that Blend singles out this piece of code to check if it’s already being<br />

called somewhere in the loaded script. If it is (as is typical with the project templates), Blend doesn’t<br />

repeat it. If it does include it, or if you specify other code here, Blend will insert it in a tag in the<br />

header.<br />

Also, errors in your OAM file will convince Blend that it shouldn’t insert the control at all, so you’ll<br />

need to fix those errors. When making changes, Blend won’t reload the metadata unless you reload the<br />

project or rename the OAM file (preserving the _oam.xml part). I found the latter is much easier, as<br />

Blend doesn’t care what the rest of the filename looks like. In this renaming process too, if you find that<br />

the control disappeared from the Assets panel, it means you have an error in the OAM XML structure<br />

itself, such as attribute values containing invalid characters. For this you’ll need to do some trial and<br />

error, and of course you can refer to all the OAM files already on your machine for details.<br />

You can also make your control available to all projects in Blend. To do this, go to Program Files<br />

(x86)\Microsoft Visual Studio 11.0\Blend, create a folder called Addins if one doesn’t exist, create a<br />

subfolder therein for your control (using a reasonably unique name), and copy all your control assets<br />

there. When you restart Blend, you’ll see the control listed under Addins in the Assets tab:<br />

166

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

Saved successfully!

Ooh no, something went wrong!