DelegateCommand for TreeViewItem Selected

Topics: Prism v4 - Silverlight 4
Nov 12, 2010 at 2:34 PM

Since the TreeViewItem does not have a command property how can I use a DelegateCommand when a TreeViewItem is selected?

 

Thanks

Nov 12, 2010 at 4:32 PM

Hi,

This is something not supported in Silverlight out-of-the-box. Silverlight 4 includes commanding support for ButtonBase classes, but the TreeViewItem class does not derives from ButtonBase.

That said, Prism provided commading support for ButtonBase classes in previous versions of Silverlight, so you could use this implementation as a reference. For more information you could take a look at the following links:

After implementing this, you could assign a DelegateCommand to the TreeviewItem like any other Binding.

Hope this helps.

Fernando Antivero
http://blogs.southworks.net/fantivero