WP7 Toolkit: Combining Hubtile, Listbox, Tilt, ContextMenu and WrapPannel

Found a much clearer set of how-to’s by windows phone geek here.

This is a post for the developers out there. I wanted to use the hubtile control from the wp7 silverlight toolkit, but along side it also use the context menu from the same toolkit, while having the whole lot databound inside a listbox. It took me a while to come up with a solution that I was happy with. I’m not sure if it’s following best practices but it seems to work well for what I want. The solution is to use a wrappannel from the same toolkit and then to place this inside “ItemsPanelTemplate” of the listbox. This means that the listbox items that are bound then appear within the wrappanel while still being part of the listbox. Then the context menu and the hubtile control can be put inside the “ItemTemplate”, coupled with the tilt animation, yet again from the toolkit, you end up with a nice tilt-y and scrollable set of hubtiles that have a long press context menu associated with them. If you’re curious to see how it all looks, the finished product is included in my latest beta of BBC News Mobile. Hopefully this is a useful how-to for, it’s my first shot at once of these so go easy!