Improvements made to my MVVM commanding solution

I woke up extra early this morning and just had to implement some enhancements to my recent MVVM commanding solution.  I took Bill‘s brilliant advice and made a concrete CommandSink class. That alone is a HUGE improvement!  I made a fix that allows the CommandSink attached property to work for elements in a template.  This is related to the timing issues Bill and I discussed, wherein there is no guarantee that my attached property will be invoked *after* an element’s command bindings are created and added to its CommandBindings property.  Also, I renamed RelayCommandBinding to CommandSinkBinding because I think that more accurately expresses the purpose of the class.

The article has been updated to explain the new features.  All of the important changes are in the How It Works section.  Also, the source code download was updated.  Here’s the link:


7 Responses to Improvements made to my MVVM commanding solution

  1. […] Josh Smith -Improvements made to my MVVM commanding solution […]

  2. John "Z-Bo" Zabroski says:

    Thanks for continuously updating your articles, Josh. Your commitment to quality is unheard of. Most authors say things like, “And the source code is freely available on the website so that it can be updated…”, but they never update the source code. That’s just one example.

    You practice what you preach, and I respect that.

  3. Josh Smith says:

    Thanks John. I’m glad people out there appreciate my work. 8)

  4. thx for the great solution, i just blogged about some minor modifications i did on your code…

  5. Dale says:

    I’ve been quite interested in your MVVM solution. I find it difficult to wrap my head around the whole MVVM thing, but after studying Microsoft Patterns and Practices’ Composite Application Guidance for WPF, I’m starting to get it. The MVVM structure provided by that guidance provides another to do it, and it doesn’t seem to require using all the features of the guidance to borrow this one way of doing MVVM. I don’t know this stuff well enough to suggest whether the Microsoft guidance has anything superior or inferior. Thanks again for pursuing these concepts and writing about them!

  6. Benjamin says:

    Josh, I have benefited greatly from following your blog and your articles. I’m trying to implement your CommandSink classes in a VB.NET project I have going and am finding it very difficult to port your CommandSink solution to VB.NET. Do you know whether anyone has successfully accomplished this? I’m sure it must be doable…

    Thanks again for everything.

  7. Josh Smith says:

    Hi Benjamin,

    I have never asked if anyone has ported it to VB before. It’s definitely possible.


%d bloggers like this: