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)

Bindings


Basically, binding is a mechanism that the whole MVVM pattern relies on. It is very powerful and is the "glue" between the view and the exposed fields and commands.

In Chapter 1, XAML in Windows Phone, we learned about a mechanism called binding and saw what binding expressions are. The current chapter, being more practical, will show how to implement such bindings.

The functionality that we want to implement is shown in the following diagram:

Model

We are going to use the Model class for storing data about users.

public class UserModel:INotifyPropertyChanged
{
  private string name {get;set;
  public string Name { get; 
    set
    {
      name = value;
      RaisePropertyChanged();
    }
  }
  public string LastName { get; set{(…)} }
  public string Gender { get; set{(…)} }
  public DateTime DateOfBirth { get; set{(…)} }

  public event PropertyChangedEventHandler PropertyChanged;
  (…)
}

One thing that we still have to implement is the property changed event subscription for all fields...