Command Binding In Silverlight

Topics: Prism v2 - Silverlight 3
Oct 28, 2009 at 3:30 AM

Hi ,

I am new to silverlight and not able to understand about Command Binding i searched many sites and not able to get any samples.

I heard that the command binding used in WPF doest work to silverlight.

If any one can Explain and give some useful link will be really helpful

thanks in advance.

Oct 28, 2009 at 12:48 PM

Hi

The phrase “the command binding used in WPF doesn’t work in Silverlight” means that Buttons or Hyperlink buttons in Silverlight, do not have a Command dependency property to which you can bind your commands to. As a way to get commanding functionality in Silverlight (and also enable the use of commands for elements other than buttons in WPF & Silverlight), you can use Attached Behaviors.

You can find detailed explanation of all the above in this post by Julian Dominguez.

Prism provides out-of-the-box, an attached behavior to enable Buttons click in Silverlight. You can read about this in this article from the Prism documentation.

Some time ago, I created a code snippet which is really useful for creating commands with attached behaviors, and added it to a Prism “snippet kit”. You might find it useful when starting to implement your own commanding functionality.

Please let me know if this helps.

Damian Schenkelman
http://blogs.southworks.net/dschenkelman

Oct 29, 2009 at 3:11 PM

Thanks a lot this is going to help mee move forward.

Jun 24, 2010 at 2:37 AM
Edited Jun 24, 2010 at 2:37 AM

Note that command binding is now available in Silverlight 4.  I did a quick tutorial on it.  You can see it here.

 

http://tsells.wordpress.com/2010/06/23/command-binding-with-wpf-and-silverlight-net-4-0-with-m-v-vm/