The Toolkit team is proud to announce the release of the Windows Phone 8 version of the Windows Phone Toolkit. Here’s what’s new:
- New toolkit download from CodePlex
- Installation exclusively through NuGet (deprecated .msi download file)
- Windows Phone 7 and Windows Phone 8 toolkits in a single package
- New controls and features
- Bug fixes
For those of you who are new to developing for Windows Phone, the Windows Phone Toolkit is an additional package of controls that you can use with the Windows Phone SDK to easily add useful controls to your Windows Phone app.
Installation and downloads
To install the Windows Phone Toolkit
- Download and install the latest NuGet package manager.
Note: The Windows Phone 8 Toolkit package requires NuGet version 2.1. If you have an older version of NuGet and try to install the Windows Phone toolkit, you’ll receive the following error message: “The package does not contain any assembly references that are compatible with that framework.” Restart all instances of Visual Studio after you install the latest version of NuGet. - Install the Windows Phone toolkit package using the following steps:
- In Visual Studio 2012, create a Windows Phone 8.0 or a Windows Phone OS 7.1 project.
- From the menu bar in Visual Studio, select Tools >Library Package Manager >Manage NuGet Packages for Solution.
- Select Online in the column on the left of the Manage NuGet Packages dialog box.
- Search for the WPToolkit package, authored by Microsoft.
- Click Install and apply the package to your project.
Note: Alternatively, you can click Select Tools >Library Package Manager >Package Manager Console. In the Package Manager Console, type:
Install-Package WPToolkit
The installation adds a reference to Microsoft.Phone.Controls.Toolkit.dll to your project. It also creates the Toolkit.Content folder, which contains resources for toolkit controls. This NuGet Windows Phone package supports Windows Phone OS7.0, Windows Phone OS 7.1, and Windows Phone OS 8.0. In addition, you can install the Windows Phone Toolkit Test Framework package to integrate unit tests for your Windows Phone apps. This NuGet package supports Windows Phone OS 7.1 and Windows Phone OS 8.0.
After you have added the Windows Phone toolkit package to your Windows Phone project, you can easily add a wide range of controls, such as the AutoCompleteBox control, the WrapPanel control, and the LongListMultiSelector control.
Control Examples
To get a better understanding of the controls provided in the Windows Phone toolkit, download the source code and samples from CodePlex. After you download the sample source code, run the Windows Phone 8 sample solution. You can look through the source to get an idea of how each control is used. Here are some of the new controls in Windows Phone 8.
Windows Phone Toolkit Test Framework
The following steps show how you can write a simple “hello world” unit test using the Windows Phone Toolkit Test Framework:
- In Visual Studio 2012, create a Windows Phone 8.0 or a Windows Phone OS 7.1 project.
- From the menu bar in Visual Studio, select Tools >Library Package Manager >Package Manager Console.
- In the Package Manager Console window enter the following:
install-package WPToolkitTestFx
The package manager will install the WPToolkit package first. Then, it will add references to Microsoft.Phone.Toolkit.Testing.dll and Microsoft.VisualStudio.QualityTools.UnitTesting.Phone.dll. It also adds AppBar icons to the Toolkit.Content folder. - At the beginning of the MainPage.xaml.cs file, add the following using statements:
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.Phone.Testing; - Replace the MainPage class in MainPage.xaml.cs file with the following code:
public partial class MainPage : PhoneApplicationPage
{
// Constructor
public MainPage()
{
InitializeComponent();
this.Content = UnitTestSystem.CreateTestPage();
}
}
[TestClass]
public class HelloWorldTests: WorkItemTest
{
[TestMethod]
[Description("Test1: Always have description")]
public void Test1()
{
Assert.IsTrue(true);
}
[TestMethod]
[Asynchronous]
[Description("Test2: Sample asynchronous test")]
public void Test2()
{
// this test executes asynchronously
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
// ... and then fails
Assert.IsFalse(true);
TestComplete();
});
}
} - Run the application in emulator mode. The Home page of the UnitTestSystem is launched.
- Click the play button in the app bar to run the tests.
- In Visual Studio, press F5 to continue execution of the app.
- When the app returns focus to the emulator, click HelloWorldTests to see the results.
For more information, see Stefan Wick’s video titled Expert Lessons: Top Tips for Building a Successful Windows Phone Application.
Reporting issues, discussions and sample requests
Use the following list to provide feedback:
- You should first check if the issue is already reported and vote for it – here http://phone.codeplex.com/workitem/list/advanced
- If it is not reported, you can create an issue using the create issue link under issue tracker - http://phone.codeplex.com/WorkItem/Create
- We monitor Developing for Windows Phone forums http://social.msdn.microsoft.com/Forums/en-us/wpdevelop regularly to address questions/concerns
- You could also contact us on twitter @shawnoster@thakkarrohan and use #wptoolkit