How to prevent closing Workspace

Nov 19, 2011 at 12:09 PM

Hi Sacha,

how can I prevent closing a Workspace?

E.g. if the user chooses "Cancel" in the Question "Save Data?" (Yes/No/Cancel)


Nov 20, 2011 at 6:02 PM

I think that is done in the WPF demo that comes with Cinch V2, you get that when you download the full source. If its not for Cinch V2 then you have to do it however your code needs it. In cinch v2 there workspacedata class allows for a cancellation, see the cinch v2 WPF demo

Nov 20, 2011 at 7:38 PM

Thanks, I found the WorkspaceTabClosing Event :-) (I use V2)

Is there a built-in way to query the "CanClose"-state from the ViewModel?

If not, can I use this way: define a public Func<bool> CanCloseCallback; in ViewModelBaseWPFSpecific.cs  ?


Nov 21, 2011 at 9:33 AM

Cool, knew it was there somewhere.


As for  query for "CanClose" there is no inbuilt support for that. You can of course add any code you want, to get your job done, that's why the ViewModelBase class is partial.

Nov 22, 2011 at 4:49 PM

Thanks, Problem solved. I use "my way".
( I think, for a business app, preveting close Workspace is essential e.g. to support validation-process )

Cinch Rulez!

Nov 23, 2011 at 6:37 AM

Cool cool, glad you like Cinch I worked hard on it.