How to prevent closing Workspace

Nov 19, 2011 at 1: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)

-christoph

Coordinator
Nov 20, 2011 at 7: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 8: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  ?


-christoph

Coordinator
Nov 21, 2011 at 10: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 5: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!

Coordinator
Nov 23, 2011 at 7:37 AM

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