Windows 8.x Phone Dev – Windows Phone Toolkit Toggleswitch Control


I’m just starting work on a little Silverlight app for Windows Phone 8.x and want to use the ToggleSwitch control on the settings page.

The ToggleSwitch is one of many useful controls that are part of the Windows Phone Toolkit – so the first step is to install the toolkit.

In Visual Studio click the Tools menu, Nuget Package Manager and then Package Manager Console. At the Package Manager prompt type the following:

install-package wptoolkit

Next add the toolkit namespace prefix to the page you are working on:


Adding toolkit controls in XAML is straightforward:


IntelliSense will give a full list of the toolkit controls for you.

<toolkit:ToggleSwitch x:Name="toastToggle"
                      Header="Enable Toast Notifications"

Above is the basic code that I used for my ToggleSwitch:


I haven’t finalized the behavior in the code behind for the ToggleSwitch but there are two events to show “On” and “Off” when the control is checked or unchecked:

private void toastToggle_Checked(object sender, RoutedEventArgs e)
            toastToggle.Content = "On";

private void toastToggle_Unchecked(object sender, RoutedEventArgs e)
            toastToggle.Content = "Off";

There are plenty of other controls worth looking at – I already have my eyes on the DatePicker and the TimePicker for this app!

Happy coding!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s