Added April 10, 2014: The second edition of this ebook, updated for Visual Studio 2013 and Windows 8.1, is posted here!
You can download the ebook in PDF format here: http://go.microsoft.com/FWLink/?Linkid=270056 (17.9 MB)
EPUB format is here: http://go.microsoft.com/FWLink/?Linkid=272592(37.3 MB)
MOBI format is here: http://go.microsoft.com/FWLink/?Linkid=272591 (69.5 MB)
The ebook’s companion content is here: http://go.microsoft.com/FWLink/?Linkid=270057 (59.9 MB) (Note: An updated version of the companion content was made available on November 8, 2012, to fix a line of code.)
This free ebook provides comprehensive coverage of the platform for Windows Store apps. Since its second preview in August, we’ve added the remaining chapters on live tiles, notifications, background tasks, background transfers, networking, devices, printing, WinRT components, accessibility, localization, and the Windows Store itself. The final ebook contains 17 chapters. And of course all of the earlier chapters have also been reviewed and refined—over 800 pages in total, along with new and updated companion content!
It has been a wild ride these last few months to finish a book of this magnitude at the same time we were building up to the public release of Windows 8. At moments like these one would like to stop, let out a long “Whew!” and rest for a while. But truly, this is just the beginning! I primarily wrote this book for those developers who have yet to delve into Windows 8 but who will certainly be very interested in the platform as it gains momentum with consumers in the coming year especially. There’s going to be a great market out there for the wonderful apps you’ll be creating, and it is my delight to help serve as a guide to that territory.
As I wrote in an earlier post, I’ve endeavored in this ebook to coalesce the collective experience of app builders who have been working with this platform from the beginning, as well as the insights and understanding of the Windows engineering team itself. I’ve also made a focused effort to highlight the amazing resources that are available in the Windows SDK samples, because they contain thousands and thousands of lines of code that you won’t have to write yourself once you know where to look! I’m hoping that my efforts in doing that research will save you the trouble and help you write some great apps in a short amount of time.
In the end, then, there is much in this ebook that will be highly valuable to developers working on Windows 8 apps in whatever language. And again, the ebook is free, so there’s no excuse to not have it in your library.
Of course, there are many bits and details that have crossed my path since I had to hand off the text to Microsoft Press. In the months ahead, then, I will be sharing those on my blog, http://www.kraigbrockschmidt.com/luminarity, as well as in postings here with Microsoft Press. I look forward to the continued journey with you!
Below is the ebook’s Introduction, which gives you more details about the ebook. Enjoy, everybody!
Welcome, my friends, to Windows 8! On behalf of the thousands of designers, program managers, developers, test engineers, and writers who have brought the product to life, I'm delighted to welcome you into a world of Windows Reimagined.
This theme is no mere sentimental marketing ploy, intended to bestow an aura of newness to something that is essentially unchanged, like those household products that make a big splash on the idea of "New and Improved Packaging!" No, Microsoft Windows truly has been reborn—after more than a quarter-century, something genuinely new has emerged.
I suspect—indeed expect—that you're already somewhat familiar with the reimagined user experience of Windows 8. You're probably reading this book, in fact, because you know that the ability of Windows 8 to reach across desktop, laptop, and tablet devices, along with the global reach of the Windows Store, will provide you with tremendous business opportunities, whether you're in business, as I like to say, for fame, fortune, fun, or philanthropy.
We'll certainly see many facets of this new user experience throughout the course of this book. Our primary focus, however, will be on the reimagined developer experience.
I don't say this lightly. When I first began giving presentations within Microsoft about building Windows Store apps, I liked to show a slide of what the world was like in the year 1985. It was the time of Ronald Reagan, Margaret Thatcher, and Cold War tensions. It was the time of VCRs and the discovery of AIDS. It was when Back to the Future was first released, Michael Jackson topped the charts with Thriller, and Steve Jobs was kicked out of Apple. And it was when software developers got their first taste of the original Windows API and the programming model for desktop applications.
The longevity of that programming model has been impressive. It's been in place for over a quarter-century now and has grown to become the heart of the largest business ecosystem on the planet. The API itself, known today as Win32, has also grown to become the largest on the planet! What started out on the order of about 300 callable methods has expanded three orders of magnitude, well beyond the point that any one individual could even hope to understand a fraction of it. I'd certainly given up such futile efforts myself.
So when I bumped into my old friend Kyle Marsh in the fall of 2009 just after Windows 7 had been released and heard from him that Microsoft was planning to reinvigorate native app development for Windows 8, my ears were keen to listen. In the months that followed I learned that Microsoft was introducing a completely new API called the Windows Runtime (or WinRT). This wasn't meant to replace Win32, mind you; desktop applications would still be supported. No, this was a programming model built from the ground up for a new breed of touch-centric, immersive apps that could compete with those emerging on various mobile platforms. It would be designed from the app developer's point of view, rather than the system's, so that key features would take only a few lines of code to implement rather than hundreds or thousands. It would also enable direct native app development in multiple programming languages. This meant that new operating system capabilities would surface to those developers without having to wait for an update to some intermediate framework. It also meant that developers who had experience in any one of those language choices would find a natural home when writing apps for Windows 8.
This was very exciting news to me because the last time that Microsoft did anything significant to the Windows programming model was in the early 1990s with a technology called the Component Object Model (COM), which is exactly what allowed the Win32 API to explode as it did. Ironically, it was my role at that time to introduce COM to the developer community, which I did through two editions of Inside OLE (Microsoft Press, 1993 and 1995) and seemingly endless travel to speak at conferences and visit partner companies. History, indeed, does tend to repeat itself, for here I am again!
Fortunately, it wasn't long before tools like Visual Studio Express and Blend for Visual Studio became available. By the spring of 2011, when I was giving many training sessions to people inside Microsoft on building apps for Windows 8, the process was becoming far more enjoyable and exceedingly more productive. Indeed, while it took us some weeks in late 2010 to get even Hello World to show up on the screen, by the fall of 2011 we were working with partner companies who pulled together complete Store-ready apps in roughly the same amount of time.
As we've seen—thankfully fulfilling our expectations—it's possible to build a great app in a matter of weeks. I'm hoping that this ebook, along with the extensive resources on http://dev.windows.com, will help you to accomplish exactly that and to reimagine your own designs.
I'm also assuming that your interest in Windows 8 has at least two basic motivations. One, you probably want to come up to speed as quickly as you can, perhaps to carve out a foothold in the Windows Store sooner rather than later. Toward that end, I've front-loaded the early chapters with the most important aspects of app development along with "Quickstart" sections to give you immediate experience with the tools, the API, and some core platform features. On the other hand, you probably also want to make the best app you can, one that performs really well and that takes advantage of the full extent of the platform. Toward this end, I've also endeavored to make this book comprehensive, helping you at least be aware of what's possible and where optimizations can be made. (Note, though, that the Store itself is discussed in Chapter 17.)
Many insights have come from working directly with real-world developers on their real-world apps. As part of the Windows Ecosystem team, myself and my teammates have been on the front lines bringing those first apps to the Windows Store. This has involved writing bits of code for those apps and investigating bugs, along with conducting design, code, and performance reviews with members of the Windows engineering team. As such, one of my goals with this book is to make that deep understanding available to many more developers, including you!
To work through this book, you should have Windows 8 installed on your development machine, along with the Windows SDK and tools. All the tools, along with a number of other resources, are listed on Developer Downloads for programming Windows Store Apps. You’ll specifically need Microsoft Visual Studio Express 2012 for Windows 8. We’ll also acquire other tools along the way as we need them in this ebook. (Note that for all the screenshots in this book, I switched Visual Studio from its default “dark” color theme to the “light” theme, as the latter works better against a white page.)
In some cases I’ve taken one of the SDK samples and made certain modifications, typically to demonstrate an additional feature but sometimes to fix certain bugs or demonstrate a better understanding that came about after the sample had to be finalized. I’ve included these modifications in the companion content for this book, which you can download at http://go.microsoft.com/FWLink/?Linkid=270057.
That companion content also contains a few additional examples of my own, which I always refer to as “examples” to make it clear that they aren’t official SDK content. (I’ve also rebranded the modified samples to make it clear that they’re part of this book.) I’ve written these to fill gaps that the SDK samples don’t address, or to provide a simpler demonstration of a feature that a related sample shows in a more complex manner. You’ll also find many revisions of an app I call “Here My Am!” that we’ll start building in Chapter 2 and refine throughout the course of this book. This includes localizing it into a number of different languages by the time we reach the end.
Beyond all this, you’ll find that the Windows 8 samples gallery as well as the Visual Studio sample gallery also lets you search and browse additional projects that have been contributed by other developers—perhaps also you! (On the Visual Studio site, by the way, be sure to filter on Windows Store apps as the gallery covers all Microsoft platforms.) And of course, there will be many more developers who share projects on their own.
In this book I occasionally refer to posts on the Windows 8 App Developer blog, which is a good resource to follow. I also recommend following the Windows Store for Developers blog for any announcements related to what is effectively your place of business. And if you’re interested in the Windows 8 backstory—that is, how Microsoft approached this whole process of reimagining the operating system—check out the Building Windows 8 blog.
Throughout this book, identifiers that appear in code, such as variable names, property names, and API functions and namespaces, are formatted with a color and a fixed-point font. Here’s an example: Windows.Storage.ApplicationData.current. At times these fully qualified names—those that that include the entire namespace—can become quite long, so it’s necessary to occasionally hyphenate then across line breaks, as in Windows.Security.Cryptography.CryptographicBuffer.- convertStringToBinary. (Imagine this breaking across lines in the ebook.) Generally speaking, I’ve tried to hyphenate after a dot or between whole words but not within a word. In any case, these hyphens are never part of the identifier except in CSS where hyphens are allowed (as in -ms-high-contrast-adjust) and with HTML attributes like aria-label or data-win-options.
In many ways, this isn't my book—that is, it's not an account of my own experiences and opinions about writing apps for Windows 8. I'm serving more as a storyteller, where the story itself has been written by the thousands of people in the Windows team whose passion and dedication have been a constant source of inspiration. Writing a book like this wouldn't be possible without all the work that's gone into customer research; writing specs; implementing, testing, and documenting all the details; managing daily builds and public releases; and writing again the best set of samples I've ever seen for a platform. Indeed, the words in some sections come directly from conversations I've had with the people who designed and developed a particular feature. I'm grateful for their time, and I’m delighted to give them a voice through which they can share their passion for excellence with you.
A number of individuals deserve special mention for their long-standing support of this project. First to Chris Sells, with whom I co-authored the earliest versions of this book and who is now leading development efforts at Telerik. To Mahesh Prakriya, Ian LeGrow, Anantha Kancherla, Keith Boyd and their respective teams, with whom I've worked closely, and to Keith Rowe, Dennis Flanagan, and Ulf Schoo, under whom I've had the pleasure of serving.
Thanks also to Devon Musgrave at Microsoft Press, who put in many long hours editing my many long chapters, many times over. My direct teammates, Kyle Marsh, Todd Landstad, Shai Hinitz, Patrick Dengler, Lora Heiny, Leon Braginski, and Joseph Ngari have also been invaluable in sharing what they've learned in working with real-world partners. A special thanks goes to Kenichiro Tanaka of Microsoft Japan, for always being the first one to return a reviewed chapter to me and for joyfully researching different areas of the platform whenever I asked. Many bows to you, my friend! Nods also to others in our international Windows Ecosystem teams who helped with localizing the Here My Am! app for Chapter 17: Gilles Peingné, Sam Chang, Celia Pipó Garcia, Juergen Schwertl, Maarten Van De Bospoort, and Li-Qun Jia (plus Shai Hinitz on Hebrew).
The following individuals all contributed to this book as well, with chapter reviews, answers to my questions, deep discussions of the details, and much more. I’m grateful to all of you for your time and support:
Elliot H Omiya
Marcelo Garcia Gonzalez
Edgar Ruiz Silva
Kevin Michael Woley
* For Jan and Cameron, a special acknowledgement for riding down from Redmond, Washington, to visit me in Portland, Oregon (where I was living at the time), and sharing an appropriately international Thai lunch while we discussed localization and multilingual apps.
I would also like to bid adieu to the extra pounds that have accompanied my body while I’ve been sitting at a computer far more than I should! I’m sure you’re looking forward to a resumption in our more usual fitness routines as I am.
Finally, special hugs to my wife Kristi and our young son Liam (now six), who have lovingly been there the whole time and who don't mind my traipsing through the house to my office either late at night or early in the morning.
If you need support, email Microsoft Press Book Support at email@example.com.
At Microsoft Press, your satisfaction is our top priority, and your feedback our most valuable asset. Please tell us what you think of this book at
We read every one of your comments and ideas. Thanks in advance for your input!
Let’s keep the conversation going! We’re on Twitter: http://twitter.com/MicrosoftPress. And you can keep up with Kraig here: http://www.kraigbrockschmidt.com.
Great book so far! I love Kraig's style of writing, and already had a good laugh at some paragraphs.
What about an EPUB version? It's not too hard to create one, right? :)
Hi, everybody asking about EPUB & MOBI files. We'll get those out this month, we promise.
Hi guys, great job on the ebook, looking forward to learning this stuff. I'm using a stable version of Chrome, and clicking the link, or pasting it directly into the addressbar hasn't worked, and nothing could visibly happen. I had to right click and click Save Link As... to download the pdf file.
Great book, but Amazon has 50MB limits to deal with MOBIs convenient way... Can you please do something with the size of MOBI to get it below 50MB - ? Thanks a lot...
Hi... thanks fo this great ebook. Very helpfull.
Thanks for the book! I love the ePub format
Please change the name of the companion content zipped folder. I ran into an extraction error for "Destination Path Too Long" when trying to extract the folder. Changing the folder name to something shorter than the default removed the error. Thanks for this great book. It's a life saver.
Hear it's a great book. Can't wait to read it
Thank you very much! This things help us a lot to achieving the next certifications and to be up to date in new software releases
Am reading the book and must say that it is completely awesome! It is by far the best resource on Windows 8 app development using WinJS that is out there. You have given me so many "Aha!" moments and every other page you answer a question where I find myself saying, "How did you know I needed to know that!!" Many thanks.
A great book indeed.
But what about for the C#/Visual Basic book? Looking forward on it.
Charles Petzold will have his C#/XAML book out early in the new year, I believe. It's too much work for me to try to write the same book in another language...but then again, most of the chapters past Chapter 8 are really applicable to apps in any language as they primarily deal with WinRT and not HTML/CSS. You just have to translate the JS into C# :) At the same time, the links I put in those chapters to the various samples typically have a C#/VB sample right there, so hopefully it can serve you reasonably well enough.
not so good
more examples would have been better
I found a good way to make money
a good place to exposure yourself as a freelancer to employers
any skill's in programming or designing or any other skills are Good to make money
this is my weblog: howcanifindwork.wordpress.com
I wrote something about that in there. something to share experiences in this work with others.