June 22, 2011

On Windows Phone OS 7.1, you can use LINQ to SQL to store relational data in a local database that resides in your application’s isolated storage container. This sample is a to-do list application that uses a multi-table local database. Items that appear in the list are added, updated, and deleted from a local database, where they persist between application launches. For information about how to develop this application step-by-step, see How to: Create a Local Database Application with MVVM for Windows Phone.

You need to install Windows Phone SDK 7.1 Beta 2 to run this sample. To get started, go to App Hub.

Required: Installing the Silverlight for Windows Phone Toolkit

This sample requires the Silverlight for Windows Phone Toolkit (it uses the ListPicker control). Perform the following procedure to install the toolkit, set the necessary assembly reference, and run the sample.

To install the Silverlight for Windows Phone Toolkit

  1. The Silverlight for Windows Phone Toolkit is not included with Windows Phone SDK 7.1 Beta 2. You must download the toolkit separately from the Silverlight Toolkit web site on Codeplex. Navigate to that website and click the link to Silverlight for Windows Phone Toolkit.

  2. From the Silverlight for Windows Phone Toolkit webpage, click the link with the .MSI file extension and install the toolkit.

  3. After the toolkit is installed, note the path to the toolkit binaries. In Windows 7, you can find the folder in Windows Explorer by clicking Start, All Programs, Microsoft Silverlight for Windows Phone Toolkit, and Binaries.

  4. In Visual Studio, add the Silverlight for Windows Phone Toolkit assembly to your project. From the Project menu, click Add Reference.

  5. From the Add Reference window, click the Browse tab and then navigate to the folder where the Silverlight for Windows Phone Toolkit binaries are located.

  6. Select the assembly named Microsoft.Phone.Controls.Toolkit.dll and then click OK. In Solution Explorer, the Microsoft.Phone.Controls.Toolkit assembly will appear in the References folder.

  7. You have now finished preparing the sample. Press F5 to start debugging and test the application.

Note:

When the application launches for the first time, no to-do items appear in the list. Isolated storage is not persisted between launches of Windows Phone Emulator. Run the application on a Windows Phone OS 7.1 device to observe data being stored in the database between application launches.