WindowManager params ?

Nov 10, 2010 at 7:09 PM
Edited Nov 10, 2010 at 7:18 PM

 var wm = new WindowManager();
            wm.ShowDialog(vm, ctx);


above ctx is optional, however, I am trying to figure it how it would be used.  any ideas? 

Nov 10, 2010 at 8:37 PM

It is used to specify the View's Context. In Caliburn/Caliburn.Micro we support multiple views over the same ViewModel. If you don't specify a context, we find the default view. If you do specify a context, it is used to locate a specific view. I have a sample coming that demonstrates multiple views over the same view model, though it doesn't demo it via the window manager. Does that clarify things?

Nov 10, 2010 at 8:44 PM

The Context parameter has the same meaning of the View.Context attached property (tically used in Xaml).
Context is user to discriminate between different Views available for the same ViewModel.
This could be used, for example, to support view/edit scenarios, in which you may have two different version of the View depending on the opening mode, while the VM is the same.
If a Context parameter is passed to ShowDialog (or is set into View.Context property for an hosting ContentControl in Xaml) the ViewLocator searches for a View in the form:


(for example MyApp.Person.Edit, MyApp.Person.View, MyApp.Appointment.View)

Nov 10, 2010 at 8:45 PM

Ouch, a double reply again :-) I'm definitely TOO SLOW :-)

Nov 10, 2010 at 8:48 PM

Your answer was better though :)