Custom Windows Phone 7 Behaviors for Expression Blend

Channel 9 recently posted the videos from the Windows Phone Design Days Series.   Celso Gomes gives a whirlwind tour of building a simple app using Expression Blend.  In his presentation Celso uses 3 behaviors to help build his application.  In case you were interested in following Celso’s app or want to make use of the behaviors he shows I’ve posted them here.

GoToPageCustomAction.cs

Can be attached to a ListBox (and only a ListBox, so don’t try and attach it to anything else) to navigate to another page when the user selects an item from the list, setting the DataContext to the the selected item.

BackAnimationBehaviour.cs

Is useful for animating the closing of a page when the user presses the back button.  It has one property BackTransition which is the transition storyboard to play before navigating backwards

OrientationStateBehavior.cs

This is a very useful behavior for switching between states when the orientation of the phone changes.  It has two properties LandscapeState and PortraitState which are, unsurprisingly the states to display when in each orientation (don’t forget you still need to set SupportOrientation on the page).

See Celso’s presentation for an example on how to use these behaviors in practice.

Download the behaviors here.  Simply add the files to your WP7 project and compile and the behaviors should show up in Blend automatically.

Stay tuned for a more detailed explanation of these behaviors if you haven’t had the chance to check out Celso’s presentation.

About these ads

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