While the default controls in the Windows Phone SDK are nice, there are more free controls you can download and use as well to make your applications even better!
My continuing adventures exploring Windows Phone application development. If you missed my early stories, you can find them here. Don’t forget Canada, you only have until May 20th, 2012 to have your app published to get prizes from developermovement.com
I finally have a bit of time to go back to my Windows Phone app. I have a textbox for entering a time which forces numeric input. It works but I can’t help but feel there should be a better control than just a textbox. When I look at other windows phone apps I see a lot of really nice looking controls that I don’t see in my toolbox. After a little searching I discovered you can download a Windows Phone Toolkit and get more new Windows Phone controls for free!
In this blog post I’ll talk about.
- How to install the toolkit
- How to add the new controls to my toolbar
- What controls are in the toolkit
So let’s see if I can figure out how to install this and take a look at what it gives me.
Install the toolkit
- First I download the Silverlight for Windows Phone Toolkit.msi file to install the toolkit
- Run the file (you can save it then run it if you prefer, but I have pretty good internet connectivity so I’m going to run it directly)
- Now the installer launches, I accept the license agreement, click install, choose allow when prompted whether I want to let Windows run this software, and within a minute I get a message saying the software is successfully installed.
Getting the new controls on your toolbox
It’s installed, so now I launch Visual Studio and open up my project, but…uh… I don’t see anything different! When I go to the toolbox I still see the same list of controls. I look at the documentation tab ‘This project does not have documentation yet’, I read the page,lots of stuff about the controls, nothing about how to get them to show up in Visual Studio! Developer community to the rescue, a few Bing searches reveals the answer.
1. In the Solution Explorer, add a reference to toolkit.dll which was installed but may not be added as a reference to your project. It shows up as Microsoft.Phone.Controls.Toolkit after you add the reference.
2. Add a new tab to your toolbox by right clicking on the toolbox and choosing Add Tab (You don’t have to do this, but by creating a new tab you can put all the new controls in one place so you can easily find them)
3. Add the controls to the toolbox by going to your new tab in the toolbox, right click and choose Choose Items. In the Filter box type Microsoft.Phone.Controls so that all the phone controls are listed. Then select all the new controls you want to add. Just a quick note, some of these aren’t really controls unto themselves and are classes that are used by the controls (for example ListPickerItem is an item in the ListPicker Control). So you may not want to add all of them to your toolbox. Adding the reference allows you to use their functionality, adding them to the toolbox just gives you the ability to drag and drop them to your screens.
4. You should now see the controls in your toolbox
What new controls do I get?
Wow there are a lot of them I’ll do what I can here to summarize, but I may not cover every single control. I’ll break it down the same way I did when I talked about the Windows Phone standard controls. There is no formal documentation of this toolkit so I have hunted for blog posts to help wherever possible.
Controls for entering and displaying data
- AutoComplete – This control allows you to have a list of words in the properties of the control. For example states, cities, provinces, countries. When someone starts typing in the control if they start typing a value in your list it will autocomplete the word. Found a blog with some tips on how to use it here
- DatePicker – I like this one, it allows users to choose a date by scrolling to choose the day, month and year.
- ListPicker – This is basically a combo box control for Windows Phone, for really long lists you might prefer the LongList control. I found a blog post on ListPicker here.
- RecurringDaysPicker – Enables you to select one or more days of the week
- TimePicker – allows you to select a time of day
- PhoneTextBox – is a rich text box control that allows action icons inside the text box that the user can tap as well as hints for users and length indicators. Good blog post here
- LongListSelector – This is a good control for list boxes with a lot of values for the user to choose from. Found a good blog post here.
- MultiSelectList – this is a list box control that allows you to select more than one value. Good blog post here.
- ToggleSwitch – This is a great little control that is used in many Windows Phone applications for specifying ON/OFF values. Good blog post here.
Controls that do stuff
- ContextMenu – you’ve seen this before, when someone taps and holds an item on the screen and a little pop up menu appears. We do it a lot in Windows applications. Like when you are in Microsoft Word and you right click you get a context menu for Cut, Copy & Paste. I found a blog post with some tips on this control here
- PerformanceProgressBar – This control allows you to give feedback to a user about progress of a long running operation. Blog post here.
Controls to make things look pretty
- HubTile – just like the live tiles you see on the front page, you can add tiles to your application. Good blog post here.
- WrapPanelControl – this allows you to create a panel that will organize child controls either horizontally or vertically. Blog post here.
- LockablePivot – this control allows you to add a mode to the pivot control so that only the current item is shown. Blog post here.