Multiple views per viewmodel in a ListView

Topics: Conventions
Feb 7, 2014 at 6:24 PM
Edited Feb 7, 2014 at 6:26 PM
I am trying to use the View.Context tag in my caliburn app to support multiple views on the same viewmodel.

I have a Root View containing the following code
    <ListView x:Name="Elements">
                <ContentControl cal:Bind.Model="{Binding}"  cal:View.Context="Tree"/>
and my root viewmodel contains
public class RootViewModel
       public ObservableCollection<DocumentViewModel> Elements 
I have defined 2 views for my document, Preview and Tree.
named the files :
...\Views\Document.Tree.xaml ->x:Class=[namespace].Views.Document.Tree
...\Views\Document.Preview.xaml ->x:Class=[namespace].Views.Document.Preview

Caliburn can't find view for the document view model, did I get the naming convention wrong somehow?
also I intercept the LocateForModel func and added some logging, I expected the third param (of type object) to be the given context but it's always null.
I'm probably missing something obvious here ...
Feb 7, 2014 at 9:57 PM
what is the name of the root view?
Feb 7, 2014 at 10:16 PM
My root view is called "RootView" and gets resolved properly.
Feb 10, 2014 at 7:11 AM
Edited Feb 10, 2014 at 7:11 AM
try putting Tree.xaml and Preview.xaml into a folder called Root under Views