The Silverlight Toolkit for Windows Phone (Latest version is February 2011) contains a Tilt Effect implementation. To add it to your controls requires the addition of an XML namespace definition and one dependency propery set in your page XAML.




However the implementation doesn’t apply the effect to all the same places as you will find it in the native application. So far I’ve identified the ListPicker and MenuItems within the ContextMenu control. You can add additional types to receive the Tilt effect and I’ve raised an issue in the CodePlex project so hopefully this will be addressed in the next update. In the meantime you can add the following to your App constructor:-


By itself I found that this didn’t actually fix the ContextMenu and the items do not tilt as they do in built in applications. However all is not lost! If you apply the property to each entry in your ContextMenu it does use the feature:-

      <toolkit:MenuItem toolkit:TiltEffect.IsTiltEnabled="true" Name="firstMenuItem" Header="edit" Click="FirstMenuItem_Click"/>
      <toolkit:MenuItem toolkit:TiltEffect.IsTiltEnabled="true" Name="secondMenuItem" Header="delete" Click="SecondMenuItem_Click" />

Once you’ve done this you’ll have a context menu which behaves closer to the built in control. The Silverlight Toolkit is a great resource for additional controls and features which are not present in the Windows Phone 7 SDK. As always I’m eagerly awaiting the next update!

About the Author Peter Freeman Foot

Microsoft Windows Development MVP