Silverlight Toolkit for Windows Phone? What does it bring to the table?

DZone 's Guide to

Silverlight Toolkit for Windows Phone? What does it bring to the table?

· Mobile Zone ·
Free Resource

Developing for Windows Phone 7 is fun and the default SDK comes pre-loaded with the basic set of components that allows you to build fully-functional Windows Phone 7 applications. Of course, there are some controls out there that are used in the OS itself but you aren't able to insert those directly without your own implementation. For this specific case, Microsoft released and continues to maintain the Silverlight Toolkit for Windows Phone.

Download and install it. Once done, in an existing Windows Phone 7 application project, you need to add a reference to the toolkit libraries. Those are located in <SystemDrive>:\Program Files (x86)\Microsoft SDKs\Windows Phone\v7.0\Toolkit\Nov10\Bin (for 64-bit systems) or <SystemDrive>:\Program Files\Microsoft SDKs\Windows Phone\v7.0\Toolkit\Nov10\Bin (for 32-bit systems).

You need to add a reference to Microsoft.Phone.Controls.Toolkit.dll:

Then, you need to add a namespace reference in the page itself:


Now you can add controls to your page by prefixing the objects with toolkit:

So here is what you get by using the toolkit.


This control is extremely helpful when you have a pre-set collection of words and you want to make it easier for the end-user to type those words. Don't confuse this control with the auto-correct option that you can get for a TextBox control - AutoCompleteBox works as contextual suggestions. It won't automatically correct a word, even if it wasn't typed correctly. To tie this control to your set of words, you should use the ItemsSource property and bind it, for example, to a List<string>.


This is a control that can easily be used to trigger specific actions targeted to a specific control. For example, you might want to implement a custom copy & paste mechanism in your application or you want to have specific actions performed on an image. Instead of cluttering the main UI, you can trigger the list of actions on continuous touch.


For now, I haven't seen this control to be massively used, but nonetheless it offers a great way to select a specific date. It returns a DateTime instance that is nullable (can be set to null).


Sometimes this can be considered as an alternative to the ComboBox, sometimes to a ListView. The interesting fact about this control is that it changes appearance depending on the number of items passed to it from the bound collection.

If there are 5 or less items, it will appear as a dropdown list right on the page:

When more item are present, a separate list container page will be displayed. It isn't really a page, but rather a container that goes on top of the existing page.


This is the same control that it is used in Zune and the contact list on Windows Phone 7. It is the same ListView, however items can be now grouped and the groups easily accessed by clicking on the group header. The name of the control speaks for itself - it is targeting very large lists.


Having the same structure as DatePicker, TimePicker is used to select a time value. The returned result will be DateTime also represented as a nullable type.


When the radio button is not enough, you can let the user switch between states with a slider. If you've already used a real Windows Phone 7 device, then you probably know that ToggleSwitch is used in the system settings (e.g. to turn the WiFi on or off). Speaking of this control, I recently was working on my own implementation of ToggleSwitch.In my opinion, this control is much more intuitive from a user's perspective than any other possible switch.


This is basically a combination between a StackPanel and a Grid. It works based on the same idea as the regular Silverlight WrapPanel. I find it useful when you need to display small snapshots (e.g. photos) in an organized manner with custom orientation.


As you can see, the Silverlight Toolkit for Windows Phone 7 brings more value to the component part of the application. Although it is an additional dependency, it will most certainly help you in the long run when you won't have to reinvent the wheel (unless you want to do it for fun). So far, the toolkit is regularly updated, so I would recommend you checking the CodePlex page for updates from time to time. 


Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}