Pining for Windows Phone 7 controls? We got ya covered! [Announcing the first release of the Silverlight for Windows Phone Toolkit!]

This blog has moved to a new location and comments have been disabled.

All old posts, new posts, and comments can be found on The blog of

See you there!

Comments (35)
  1. Will says:

    Nice post! However, I noticed some sentences don't have a bold word. 😉 Dark side FTW!

  2. David Anson says:


    Thanks for bringing that to our attention. Those responsible have been sacked.

    – The Management 🙂

  3. Janki says:

    Excellent work guys. Final pieces missing : Calendar and LIstBox Reordering out of the box. I am sure they will be added to Silverlight TOolkit for WP7 in due time :). Again thx for awesome job.

  4. TheBlueSky says:

    Great! 🙂

    I think the most missed control is TransitioningContentControl. Is there a plan to add it?

  5. David Anson says:


    Thanks for the suggestions! I'll pass them on for consideration. 🙂

  6. ThreeChanges says:

    How do you make DatePickerTitle and AppBar names localized?

    The names do not change automatically and I can't find a property to set these to my own values.


  7. David Anson says:


    These strings come from the standard .NET RESX file for Microsoft.Phone.Controls.Toolkit and can be localized in the usual manner of creating a culture-specific resource assembly. These steps are documented here:…/ff637522(v=VS.92).aspx

    Hope this helps!

  8. Shankar B says:

    I have installed Silverlight for Windows Phone Toolkit – Sept 2010 and trying to compile the sample source/application provide here.

    But getting error as "Error HRESULT E_FAIL has been returned from a call to a COM component."

    Any fix please.

    Shankar B.

  9. David Anson says:

    Shankar B,

    It sounds like there was a problem installing the Windows Phone Developer Tools that are used to build phone projects like the Toolkit samples. Please try creating a new Windows Phone application project from Visual Studio and compiling that. If it fails, the problem is definitely with the Tools install and you can do a web search for resources to help diagnose and correct that. If that works, but the Toolkit samples are still not compiling for you, that would be somewhat surprising as I know others have successfully built and run the samples project. I'd recommend trying to download and unzip the samples again – and maybe unblock the ZIP after downloading (directions here:…/why-didn-t-i-think-of-that-in-the-first-place-windows-phone-7-charting-example-updated-to-include-reusable-platform-consistent-style-and-templates.aspx) just in case that's the problem.

    Hope this helps!

  10. How do I get these in the toolbox? says:

    None of these controls are in the designer toolbox.  How do I get these to show up in the toolbox?

    c:Program FilesMicrosoft SDKsWindows Phonev7.0ToolkitSep10Bin

    226,816 Microsoft.Phone.Controls.Toolkit.pdb

    131,752 Microsoft.Phone.Controls.Toolkit.xml

    144,696 Microsoft.Phone.Controls.Toolkit.dll

    Is this even the right stuff?  If it's supposed to install and just work, something has failed.

  11. This gets you going says:…/Adding-Silverlight-Toolkit-Controls-to-the-Visual-Studio-and-Blend-Toolbox.aspx

    has the basic idea, though it's different.  Sort on the …Toolkit and add only those items.  Pointer was no selected but went in there and I don't know why.  Why this has to be done manually?  Some step missed in install?

  12. David Anson says:

    How do I get these in the toolbox?/This gets you going,

    There are actually *two* answers here… 🙂

    The reason the Phone Toolkit controls are not automatically added to the Blend Toolbox is that when they are, Blend will crash as soon as you try to use any of the Toolkit controls in the Toolbox. This ends up being because the XNA assemblies violate one of rules about .NET strong-naming – but they do so deliberately and the owners weren't in a position to correct the issue when we discovered this. Therefore, the Toolkit assemblies are not automatically added to the Blend Toolbox – but the good news is that Blend will automatically populate Toolkit controls in the Toolbox list for projects that already reference Microsoft.Phone.Controls.Toolkit.dll and won't subsequently crash. So as soon as you add a reference to the Toolkit assembly, your Blend experience should be great.

    The reason the Phone Toolkit controls are not automatically added to the VS Toolbox is a bit of a mystery – thank you for reminding me that I need to follow up on this! As far as I know, the Toolkit MSI is doing the right things to add its controls to the VS Toolbox (the same things the Silverlight Toolkit does successfully), but they're not showing up there – and we weren't able to get to the bottom of this before we released. I'm going to revisit this with the relevant folks now and see if we can fix this for the next release of the Toolkit.

    Thanks for bringing this up – I hope the semi-manual steps will work okay for now! 🙂

  13. Suneet Bendre says:

    How can i get the value of Date Picker to Text box or List box

  14. David Anson says:

    Suneet Bendre,

    I think you're looking for the DatePicker.Value property which is a nullable DateTime. You can assign this value to other controls directly, via the .ToString() method, or via one of the other helper methods like .ToLongDateString().

  15. Mark says:

    I created a new application to test this out, and it works fine. However, in my existing application, when you press the box, it opens the DatePickerPage, the icons are at the bottom, but the actual date picking controls are not there. Any ideas on what could cause that?

  16. David Anson says:


    My psychic debugging powers suggest to me that maybe your application overrides NavigationService events, cancels navigation in certain circumstances, and does not special-case the navigation that's performed by DatePicker to show the DatePickerPage. If so, please have another look at the section of this blog post where I discuss this situation and how to handle it so as not to break the way DatePicker works. If that's not the case, I'm not sure off hand why this would happen – as you note, the right functionality there because it works in a test application. If you can create a simplified demonstration of this problem, I could have a quick look to see what's going on.

  17. Mark says:

    I wasn't overriding it…however, overriding it worked 🙂 I had a style on the RootFrame to implement transitions on every page, and that style was disagreeing with the DatePickerPage. So I override the NavigationService event, nullify the style if I'm going to a DatePickerPage, and then reapply it when I'm done. Works great!

    Thanks for pointing me in the right direction.

  18. David Anson says:


    Good stuff, glad to hear that worked out! 🙂

  19. Rick says:

    Is there anyway to set the value="" in either the datepicker or timepicker to the current date or time instead of some random value?

  20. Rick says:

    Never mind, I figured it out.

  21. Bob says:

    Having a problem with the context menu, hoping there is a easy solution that you could propose….

    I have a listbox, I want a short click to navigate to another page (which has a browser control) and I want the tap and hold to show a context menu with more options.

    I would always get a crash when I did a short click after navigating to the next page (it was from the tap and hold code running after the fact). Setting IsZoomEnabled=false fixed that, which is a good enough solution for me.

    But the problem is the context menu still shows. (Sure, I did a tap, but not a hold). I tried setting context.IsEnabled=false in the listbox's SelectionChanged event handler, but that just makes it appear with choices disabled. Is there a way I can stop the context menu from showing?

    Thanks in advance.

  22. David Anson says:


    I believe you'll find that both of these problems (exception related to navigations and possible tap+hold/selection inconsistencies) are resolved in an upcoming release of the Windows Phone Toolkit. 🙂

  23. Himanshu says:

    Can anybody tell how I can attach the context menu to a button?

    I create large number of buttons (around 120 of them) during runtime and display them on screen.

    How can I attach the context menu to them using C# code during runtime?

    any suggestions?

  24. David Anson says:


    Creating and attaching a ContextMenu in code will look something like this:

    ContextMenu cm = new ContextMenu();

    MenuItem mi = new MenuItem { Header = "Click me…" };


    ContextMenuService.SetContextMenu(MyButton, cm);

    Hope that helps!

  25. CG says:

    I'm confused about how to handle the navigation from a DatePicker / TimePicker control.

    If I have a page that is populated as a result of a OnNavigatedTo override (lets say, for example, an Edit page that has an ID passed to it), which includes a DatePicker control, everytime the DatePicker control is used it resets the values on the page because the OnNavigatedTo function is called again.

    How do I get around this?

  26. David Anson says:


    What I'd recommend is to do something like what DatePicker itself does with regard to detecting the nature of each navigation. Specifically, look at the code at the bottom of DateTimePickerBase.cs to see how it handles the PhoneApplicationFrame's events to monitor and react to navigations:…/56962

    In this manner (and in combination with my blog post notes above regarding IDateTimePickerPage), you should be able to tell when DatePicker/TimePicker navigations are happening and avoid resetting your page's values at those times.

    Hope this helps!

  27. CG says:

    Hi Delay,

    Excellent, thank you, solved my problem.


  28. jim says:

    Is it possible to customise the datepicker to show month and year scrollers only?

  29. David Anson says:


    I''ve written about customizing the DatePicker/TimePicker controls here:…/there-are-lots-of-ways-to-ask-for-a-date-creating-custom-datepicker-timepicker-experiences-is-easy-with-the-windows-phone-toolkit.aspx

    You might also do some web searching – "WindowsPhoneGeek" has a few articles on this topic and the WP7Contrib project has something similar.

    Hope this helps!

  30. Jock says:

    Hi, David,

    About Listpicker or datepicker, do you know what the exact font is for header attribute? I tried to create TextBlock using the same font, but failed.



  31. David Anson says:


    If you're referring to the header of an expanded DatePicker, it looks like it's:

    FontFamily="{StaticResource PhoneFontFamilySemiBold}"

    FontSize="{StaticResource PhoneFontSizeMedium}"

    You can see this in DatePickerPage.xaml here:…/61620

    Another good place to look is Generic.xaml – you'll see that ListPicker uses the same font family/size for its header in Expanded view:…/61620

    Hope this helps!

  32. Laurent says:

    Just a question: I want to store the date of a DatePicker for a next launching of an application but I don't know how to do that?

  33. David Anson says:


    Unless I'm misunderstanding the scenario, all you should need to do is capture the selected DatePicker.Value after the user picks one, save it along with the rest of your application state, and then restore that same value just before showing the DatePicker the next time.

  34. Laurent says:

    I'm not sure to understand what you mean. So to be  clear, using this link (…/ff769510%28v=vs.92%29.aspx) I create an ApplicationSettings class (I can provide the code if necessary). I want to apply the same pattern for a DatePicker and that does not work (the application first launch with the default value but when I want to comme back after the application does not launch). I can provide to you the code if it helps.

  35. David Anson says:


    If the application is failing to launch the second time, then it's probably hitting an exception somewhere. Try catching that in the debugger and it will probably help identify what's going on. Also, you might find some of what I discuss in this post about DatePicker helpful:…/there-are-lots-of-ways-to-ask-for-a-date-creating-custom-datepicker-timepicker-experiences-is-easy-with-the-windows-phone-toolkit.aspx

    Hope this helps!

Comments are closed.

Skip to main content