Silverlight Toolkit and the Windows Phone: WrapPanel, and a few others
Are you looking for WrapPanel for your Windows Phone application? Look no further. The Silverlight Toolkit has several controls that work pretty well on the Windows Phone.
I wanted to provide my own informal look at how it’s working with Silverlight for Windows Phone today.
Note that this information is only current as of today, 3/21, when used with the MIX-related CTP of the tools and emulator, and the November 2009 Silverlight Toolkit. A lot could change, and this is not exhaustive.
I’m also including some controls that are found in the Silverlight SDK today. I present these in order of how much I have used the components while building apps.
WrapPanel and DockPanel
Found in the Silverlight Toolkit, System.Windows.Controls.Toolkit.dll (SWC.Toolkit).
Work great.
If you just need the WrapPanel, and don’t want to include the entire toolkit assembly, you can just paste these source files into your application project instead (license: Ms-PL):
Charting and Data Visualization
There is a known issue with LINQ that prevents the controls today from working perfectly. A small, targeted fix has been made in the charting codebase and a future release will work well on the device.
Re-templating and styling the control is very important, and required, for working on the phone in an acceptable manner. I hope to share any decent templates I can come up with.
HeaderedItemsControl, HeaderedContentControl
Work great. Split between System.Windows.Controls (SWC) and SWC.Toolkit.
TreeView
SWC. Functional; requires massive re-templating and styling. Font sizes are much too small, and the theme and visuals do not appear code-name “Metro” compatible.
AutoCompleteBox
Found in the System.Windows.Controls.Input SDK library of the Silverlight 3 SDK.
Works OK, not ready for general development use.
Drop-down appears well. Major features all work. However, touching an entry in the drop down only performs selection. A second touch is required to verify the choice, effectively requiring a double-tap in use.
Calendar, DatePicker
SWC. Limited functionality, too small visually. Not designed for touch – not enough space to reliably click on a date. Require massive re-templating. Do not resemble the same experience as the date picker built into the Windows Phone operating system.
GridSplitter
Works, but may pose difficult to use on a device: requires much larger padding and custom templates to make the touch area visible and useful.
Not yet checked
DataGrid, DataPager, ChildWindow, Label, NumericUpDown, DomainUpDown, DataForm, Rating, TimePicker, TimeUpDown, GlobalCalendar, TransitioningContentControl, TreeMap, BusyIndicator, Viewbox, Expander, Accordion, drag and drop features, and many more.
We’re also still developing a story for the toolkit’s phone story moving forward. As there is a lot of momentum around the phone in the company, it’s very likely that some set of phone tools, samples, and toolkits come out.
Hope this helps.


[...] Silverlight Toolkit and the Windows Phone: WrapPanel, and a few others [...]
Jeff,
I’ve been working on a full featured twitter app for WP I really want to use a pivot control to switch between time lines but I am completly stuck on how to build it…
I’ve thought about an items control using animations, I think the manipulation events would work…
Or a list box with horizontal stack. My biggest question is how to make it cyclic…
Ideas, or maybe you have time to blog how to build one ?:)
@Paul,
Yeah, there isn’t a standard pivot control available yet. We’re working on fixing this, but in the meantime, there isn’t a good alternative – sorry!
[...] Jeff Wilcox – Silverlight Toolkit and the Windows Phone: WrapPanel … [...]
Hi Jeff,
I have tried to port my SL4 app game to WP7. Unfortunately, there is no Viewbox in …\Silverlight\v4.0\Profile\WindowsPhone\System.Windows.dll. So I included the viewbox sources from SL toolkit v3.0 in my project. But, the compiled Viewbox can’t be searched (VisualTreeHelper) for childs like the SL4 Viewbox can. There is only a single ContentPresenter in it and not the element tree applied via template. I have used the Viewbox inside of a UserControl and the user control has a ControlTemplate (with element tree) applied.
Have you any tip regarding this problem?
Will the next release of SL4 for WP7 contain the ViewBox?
Best Regards,
Paul
[...] Silverlight Toolkit and the Windows Phone: WrapPanel, and a few others (Jeff Wilcox) [...]
Any chance you could post the project file?
I’ve tried every way from sunday to get Wrap Panel working…..
[...] Jeff Wilcox – Reusing the Silverlight Toolkit for Windows Phone [...]
[...] http://www.jeff.wilcox.name/2010/03/toolkit-and-the-windows-phone/ [...]
[...] http://www.jeff.wilcox.name/2010/03/toolkit-and-the-windows-phone/ [...]
I’m having the same problem as Eric. I get a series of errors including:
“The name ‘Properties’ does not exist in the current context”
and
“No overload for method ‘isNaN’ takes 0 arguments”
and
“The name ‘NumericExtensions’ does not exist in the current context”
and
“The type or namespace name ‘LengthConverter’ could not be found (are you missing a using directive or an assembly reference?)”
I’ve tried going to the definitions and writing them explicitly into the project, but to no avail. Could you please publish the project in which this works so we can see it in action?
@Matthias,
The Properties are easy – just surround that for now in quotes. It’s trying to pull a string from the resources in the assembly for that error message.
Not sure about the rest, will look into it.
I surrounded the “Properties” errors with quotes. I also opened up the Silverlight toolkit and moved the following files into my project.
LengthConverter.cs
NumericalExtensions.cs
TypeConverters.cs
Then I changed every “myDouble.IsNaN” to “myDouble == double.NaN”.
This stopped all the errors and I was able to at least put a WrapPanel into the project. However, when I put something into the WrapPanel, I get the following error.
“UIElement.Measure(availableSize) cannot be called with NaN values in availableSize.”