Article: Handling a Window's Closed and Closing events in the View-Model

This article discusses an attached behavior that lets you handle the View Window’s Closed and Closing events via commands in the View-Model. It was inspired by Reed Copsey, Jr.’s Blend behavior which is up on the Expression Code Gallery. Reed’s behavior uses a neat technique that lets the View-Model handle the Closing/Closed events of the View in an MVVM friendly manner. Since his code was tied to the Expression DLLs I thought it would be a good idea to write a plain WPF version. While similar in concept to the Blend behavior, I’ve slightly deviated from how the concept is implemented and also in how it’s used. So this is not a direct 1-to-1 replacement though you should be able to get things working pretty much the same without too much effort.

Article Link

One thought on “Article: Handling a Window's Closed and Closing events in the View-Model”

  1. Hi Nish,

    VS2008 has intelisense for C++/CLI, MS should take full responsibility for dropping this feature on VS2010 and put it back in next Hotfix. Don’t you think so?

    Regards

    Vincent

Leave a Reply