Skip to content

WP7: Tilt Effect on Menus

April 8, 2011

The Silverlight Toolkit for Windows Phone contains a Tilt Effect implementation as mentioned by Pete Vickers from Appa Mundi.

This basically allows you when pressing the ListPicker or MenuItem in WP7 to tilt slightly when you press it briefly on the screen.

To add it to your controls, you need an addition of an XML namespace definition and one dependency property set in your page XAML.

<phone:PhoneApplicationPage

xmlns:toolkit=”clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit”
toolkit:TiltEffect.IsTiltEnabled=”True”>

From my knowledge the implementation of tilt can only work with the ListPicker and MenuItems within the ContextMenu control. You can add additional types to receive the Tilt effect but check Codeplex for this. You can add the following to your App constructor:-

TiltEffect.TiltableItems.Add(typeof(ListPicker));
TiltEffect.TiltableItems.Add(typeof(MenuItem));

However this alone does not fix the implementation of the tilt effect inside the Context menu. If you apply the property to each entry in your ContextMenu it does use the feature:-

<toolkit:ContextMenuService.ContextMenu>
   <toolkit:ContextMenu>
      <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” />
   </toolkit:ContextMenu>
</toolkit:ContextMenuService.ContextMenu>

So in actual fact, the Silverlight Toolkit can be used for implementation of P7 tools, and is a great resource for additional controls and features which are not present in the Windows Phone 7 SDK. You can also use the Nuget which has even more packages to which you can apply within WP7.

Advertisements

From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: