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 dlaa.me.
See you there!
Comments
- Anonymous
September 16, 2010
The comment has been removed - Anonymous
September 16, 2010
Will, Thanks for bringing that to our attention. Those responsible have been sacked.
- The Management :)
Anonymous
September 16, 2010
The comment has been removedAnonymous
September 16, 2010
Great! :) I think the most missed control is TransitioningContentControl. Is there a plan to add it?Anonymous
September 17, 2010
Janki/TheBlueSky, Thanks for the suggestions! I'll pass them on for consideration. :)Anonymous
September 21, 2010
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. Thanks!Anonymous
September 21, 2010
ThreeChanges, 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: msdn.microsoft.com/.../ff637522(v=VS.92).aspx Hope this helps!Anonymous
September 21, 2010
The comment has been removedAnonymous
September 22, 2010
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: blogs.msdn.com/.../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!Anonymous
September 26, 2010
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.Anonymous
September 26, 2010
shawnoster.com/.../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?Anonymous
September 26, 2010
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! :)Anonymous
September 29, 2010
The comment has been removedAnonymous
September 29, 2010
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().Anonymous
October 03, 2010
The comment has been removedAnonymous
October 03, 2010
Mark, 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.Anonymous
October 04, 2010
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.Anonymous
October 04, 2010
Mark, Good stuff, glad to hear that worked out! :)Anonymous
October 26, 2010
Is there anyway to set the value="" in either the datepicker or timepicker to the current date or time instead of some random value?Anonymous
October 26, 2010
Never mind, I figured it out.Anonymous
October 29, 2010
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.Anonymous
October 31, 2010
Bob, 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. :)Anonymous
December 20, 2010
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?Anonymous
December 21, 2010
Himanshu, Creating and attaching a ContextMenu in code will look something like this: ContextMenu cm = new ContextMenu(); MenuItem mi = new MenuItem { Header = "Click me..." }; cm.Items.Add(mi); ContextMenuService.SetContextMenu(MyButton, cm); Hope that helps!Anonymous
January 11, 2011
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?Anonymous
January 11, 2011
CG, 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: silverlight.codeplex.com/.../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!Anonymous
January 12, 2011
Hi Delay, Excellent, thank you, solved my problem. CGAnonymous
March 15, 2011
Is it possible to customise the datepicker to show month and year scrollers only?Anonymous
March 16, 2011
jim, I''ve written about customizing the DatePicker/TimePicker controls here: blogs.msdn.com/.../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!Anonymous
July 04, 2011
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. Br, JockAnonymous
July 05, 2011
Jock, 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: silverlight.codeplex.com/.../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: silverlight.codeplex.com/.../61620 Hope this helps!Anonymous
December 11, 2011
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?Anonymous
December 11, 2011
Laurent, 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.Anonymous
December 11, 2011
I'm not sure to understand what you mean. So to be clear, using this link (msdn.microsoft.com/.../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.Anonymous
December 12, 2011
Laurent, 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: blogs.msdn.com/.../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!