Book Image

Windows Phone 7.5 Data Cookbook

By : Ramesh Thalli
Book Image

Windows Phone 7.5 Data Cookbook

By: Ramesh Thalli

Overview of this book

Windows Phone 7.5 Mango contains support for apps written in Silverlight or XNA. These apps can store data on the device, and also load and manipulate data from "the cloud" and other web services.This Windows Phone 7.5 Data Cookbook has a range of recipes to help you apply data handling concepts. You will be able to apply the knowledge gained from these recipes to build your own apps effectively. This Windows Phone 7.5 Data Cookbook starts with data binding concepts at the UI layer and then shows different ways of saving data locally and externally in databases. The book ends with a look at the popular MVVM software design pattern. The recipes contained in this book will make you an expert in the areas of data access and storage.
Table of Contents (15 chapters)
Windows Phone 7.5 Data Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Saving user settings


In our first recipe, we will introduce the namespace and the classes used in isolated storage and also learn how to save simple user settings to local storage and retrieve the user settings from the local storage.

Getting ready

  1. Open the Visual Studio for Phone 7 and create a Windows Phone Application. Name the application Ch2_Recipe1 and click on OK.

  2. After you open the project, press F5 and run it to make sure everything compiles without errors.

How to do it...

Let's build a simple page to display a textbox, where one can enter a name and store it so it automatically appears each time this app is started.

  1. Open the MainPage.xaml file and change the name of the application title and page title as follows:

    <!--TitlePanel contains the name of the application and pagetitle-->
    
    <StackPanel x:Name="TitlePanel" Grid.Row="0"  Grid.ColumnSpan="2">
      <TextBlock x:Name="ApplicationTitle" Text="MY RECIPES" Style="{StaticResource PhoneTextNormalStyle}"/>
      <TextBlock...