Book Image

Windows Phone 8 Application Development Essentials

By : Tomasz Szostak
Book Image

Windows Phone 8 Application Development Essentials

By: Tomasz Szostak

Overview of this book

<p>Windows Phone 8 replaces Windows Phone 7 devices with the Windows NT kernel found on many Windows 8 components. Windows 8 will give you more options to develop better and more visually appealing PC and Tablet applications.</p> <p>A practical guide that will show you how you how to create testable MVVM applications keeping in mind the best UI practices. You will learn how to integrate peripheral sensors and social portals like Facebook and Twitter into your applications. This book shows the advantages of using modern patterns instead of the traditional way of programming.</p> <p>Starting with a Windows Phone UI description, the guide then takes you through the world of fast and fluid design guidelines. After that, you will be shown the beauty of C# and MVVM advantages, finishing with clear descriptions of mobile-application integration with peripherals and social media. Clear and well-described examples throughout will help you become a WP8 developer.</p> <p>You will also learn how to test your applications using Unit Test cut dependencies in your methods using Mocks, and use the newest features of C# such as asynchronous methods. If you are more of a designer than a developer, then there is also an explanation on how to create a consistent look and feel for Windows Phone applications.</p>
Table of Contents (12 chapters)

Chapter 1. XAML in Windows Phone

This chapter covers the basic things that can be done using the XAML language and the presentation layer that it depends on:

  • XAML introduction

  • Basic WP8 controls

  • Windows Phone Toolkit

  • Working with data

XAML (Extensible Application Markup Language) is an important part of the .NET platform that allows us to build rich and beautiful applications. There are a few ways to build a Windows Phone application; we decided to follow the XAML with C# path because this technology, despite its richness, is very comfortable to use and relatively easy to handle. The multiplicity of controls and features that we get out of the box with Visual Studio is enough to build and publish Windows Phone 8 applications.

As XAML is grammar based on XML, anyone who has a web developer's background will find it intuitive. The main goal of using this markup language is to simplify the cooperation between graphic designer and developers, but it doesn't mean that you need to have designer skills to create an XAML application and vice versa; if a graphic designer wants to help with the application design, it is not necessary to know C# (but it can be helpful). If you are still afraid of XAML code and want to try it yourself, take help of a graphic designer and almost do not touch the GUI code. You should try the Designer tool that is a part of Visual Studio or the fancier Expression Blend. Graphic designers prefer to use Blend because they can create a whole user interface, animations, and so on without writing XAML code. But we will write the code because we are developers!

The XAML specification defines the rules of mapping the .NET classes to XAML objects; for example, the following is how we define a button in XAML:

<Button Name="BtnMyButton" Click="BtnMyButton_OnClick" Content="Click me!">

It means the same as:

System.Windows.Controls.Buttonbutton = new System.Windows.Controls.Button();
button.Name = "BtnMyButton";
button.Content = "Click Me!";
button.Click += BtnMyButton_OnClick;

But we will never do that! Defining controls, containers, and so on in C# code is against patterns and good practices, and causes my soul to suffer.