I have an application build with the MVVM pattern from Josh Smith (http://msdn.microsoft.com/en-us/magazine/dd419663.aspx).
When I have several workspaces opened in my app, I want to catch the event of switching workspaces/tabs so I can save the content of the current workspace first. I have looked throught WorkspaceViewModel and ViewModelBase, but I don’t know how to add that EventHandler.
I have found a solution in another post, I just had to tweak it a little bit : What is the proper way to handle multiple datagrids in a tab control so that cells leave edit mode when the tabs are changed?
Basically I have added an EventHandler on PreviewMouseDown of my TabControl generating the different Workspaces.