Top 5 Silverlight Behaviors

Posted by Corey on October 14, 2009 at 3:35 pm.

Finding behaviors for Silverlight has become much easier with the Expression Community Gallery.  The goal is to have a central place for all things Expression.  It’s still young, but gaining steam.  Being a big fan of behaviors, I have compiled a list of my top 5 favorite Silverlight behaviors.   

5. TextboxEditMask

imagelink: http://gallery.expression.microsoft.com/en-us/CMEditMaskBehavior

For data input, there is nothing like a TextBox that handles all the formatting for you.  Jim Fisher has created a behavior that enables you to easily add a mask to a TextBox, ensuring your users aren’t entering garbage.  For more information, check out Jim’s post.

 

 

4. Resize Behavior

imagelink: http://gallery.expression.microsoft.com/en-us/ResizeBehavior

Blend has a built in behavior for dragging.  As a user, one of the first things I want to do after dragging an object is to resize it.  Alessio Galdy has created a behavior that does exactly this.  Take a look at the sample on the Gallery to see his feature rich resize behavior.

 

 

 

3. Swivel Behavior

imagelink: http://gallery.expression.microsoft.com/en-us/SwivelBehavior

Silverlight 3 introduced a number of features that many consider “eye candy” (pixel shaders, perspective 3d, animations easing).   John Papa uses the perspective 3d feature to create a swivel behavior.  This can be helpful if you, or your clients, need to conserve space.  Think about a menu with an overview and details section.  Simply create two views, attach this behavior, and one side you have the overview and the other are your details.

 

2. Mouse Wheel Scroll Behavior

imagelink: http://gallery.expression.microsoft.com/en-us/MouseWheelScroll

I can’t count the number of times I’ve gone to a Silverlight app and started using my mouse wheel to scroll through the ListBox, ScrollViewer, or ComboBox.  Along with not putting the Hand cursor on Buttons, this is my biggest pet peeve in Silverlight apps.  With Kelps’ behavior, you can easily add mouse wheel scrolling to scrollable areas.

 

 

 

 

1. Behaviors from MIX’09

imagelink: http://gallery.expression.microsoft.com/en-us/MIXBehaviorPack

These are the first set of behaviors you should download.  Posted by Peter Blois, of the Blend team, these behaviors include:

  • Media behaviors (Play, Pause, Rewind, and Stop)
  • Triggers, including an awesome MouseGestureTrigger and a StateChangedTrigger
  • Data behaviors – if using MVVM, these behaviors can save you a lot of time

Needless to say, this package is the real deal.

 

Honorable Mention - Multi-Touch Drag and Zoom Behaviors

link: http://gallery.expression.microsoft.com/en-us/MultiTouch

This is a relatively new behavior to the Gallery (by a new Silverlight MVP, Davide Zordan) and unfortunately I haven’t taken a look at it because it requires a multitouch screen, which I am lacking.  If you do, check it out.  Additionally, read Davide’s post on this behaviors implementation.

 

Best Behaviors not on the Expression Community Gallery – Physics Helper

image These set of behaviors enable you to quickly add physics to objects without having to dive into the world of a physics engine.  I highly recommend you check out “The Basics” video to get learn how to use the behaviors. 

4 Responses to “Top 5 Silverlight Behaviors”

Leave a Reply