Attached commands with prism v2 and beyond

Topics: Prism v2 - WPF 3.5
Mar 28, 2010 at 9:28 AM
Edited Mar 28, 2010 at 2:55 PM

I'm just starting out on a new prism MVVM project and I'm also pretty new to developing prism applications.  I'd like to implement attached commands and I've been looking through a few different ways such as the way described by Sacha: .  My problem is which way would be the best for me to use. Any advice would be much appreciated. Most importantly I'm looking for a method that would be compatible with future versions of prism.



Mar 28, 2010 at 9:30 AM
Edited Mar 28, 2010 at 2:52 PM

Sorry I should have added this is a desktop application created with wpf 4.


Apr 7, 2010 at 7:00 PM

Hi Richard,

I’m sorry, but I was not able to access to the link you provided nor the home page (I assumed it was

On to your question, the current version of Prism uses attached behaviors to hook control events to commands as explained in this post. I said uses because Prism’s latest version only provides a single implementation of an attached behavior, which is used in Silverlight only and might not be included in a future version as SL4 does provide a Command property in the ButtonBase class. More on this here.

As the attached behavior approach is not tied to specific Prism features (there are a couple of classes you can use to facilitate its implementation though), that approach is probably a good one. Some time ago I created a code snippet that really speeds up the creation of this kind of behaviors.

Please let me know if this helps.

Damian Schenkelman