While working an a recent app I wanted to enable tilt functionality onto a Grid that contained a few items. Unfortunetly I was unable to get the control to tilt. I tried setting all sorts of properties, but nothing worked. I downloaded the source and took a look at it, and the same time I asked the twiiter universe whether non selectable items could be “tiltable” Morten Neilson replied with exactly what I was seeing. His suggestion was to change the source which is easy enough to do. Just add FrameworkElement to the list.
// The tiltable items list.
TiltableItems = new List<Type>()
But I wanted to find a way to make this work without having to change the source for the WP7 toolkit. I love open source projects, I have two myself. But it’s a lot nicer to use the out of the box code rather than having to maintain your own.
My thought was if the toolkit limits to those items, what if I wrapped my Grid in one of them? I didn’t want to use a button because then I’d have to style it, so I tried a ListBoxItem.
<TextBlock Text="I'm now tiltable!"/>
Of course there is no need for the Grid in the above, but you get the point. This is being used outside of a ListBox and works fantastic!