How to organize ViewModels the right way?

Topics: Getting Started
Jul 4, 2013 at 1:57 PM
Edited Jul 4, 2013 at 3:33 PM
I am trying to get my head around Caliburn.Micro and how Screens are managed. The shell I am trying to build contains the main part, which takes over the whole screen, but then there are smaller panels which will be shown when the user clicks buttons. A bit like the Toolbox panel(s) in VisualStudio, when it is not pinned to the screen.

I have the main viewmodel (the shell) as a Screen. It has a property - the main part of the view, which is a Screen as well (it will be getting activated and deactivated - when panels show up, the main part has to shrink a bit). Then what about the panels? Another property on the shell VM and of type Conductor? Or should the whole lot, the shell be just a Conductor? But how then can I specify that one of the elements is the main part and should take the whole screen and the others are sitting on a side... Or Should the shell be a conductor with two elements: the main viewmodel and another conductor for the panels...?

Really doing circles here and I would appreciate any help.

-- update --
I am getting through the documentation again and I have the feeling that the shell being a conductor which has a screen and another conductor (collection of screens) is the way to go...

Planning to focus on ViewModels now and worry about their views a bit later...
Aug 5, 2013 at 3:31 PM
Yes, definitely, getting again through the documentation helped a lot:
https://caliburnmicro.codeplex.com/wikipage?title=Screens%2c%20Conductors%20and%20Composition&referringTitle=Documentation

I have a shell which is a Conductor(Of IScreen).Collection.AllActive, then the first screen (PanelsView) is a Conductor(Of Screen). It all works nicely. The PanelsView has all the buttons created for activating each panel, and then this container into which the framework loads a view after a button is pressed:
<ContentControl x:Name="ActiveItem" />
where each button does something like (with a different view model for each button, obviously)
    Public Sub ShowEntryPanel()
        Dim item As EntryViewModel = IoC.GetInstance(GetType(EntryViewModel), Nothing)
        ActivateItem(item)
    End Sub
It is all very closely following the documentation really. Whether it is "the right way", or not, I cannot really say, but it works the way I want it to :)