How to bind next control ?

Nov 25, 2010 at 3:23 PM
Edited Nov 25, 2010 at 3:26 PM


I probably didn't get how caliburn searches View/ViewModels and I'm still going wrong way.
I have (very simple) ShellView (for example, I can use template from here)

<UserControl x:Class="Project.Views.ShellView">
<!-- ...something in header -->

     <!--some binding for ShellView, it works -->
<c:MyNextView /> </Grid> </UserControl>

Ok, ShellView has its ShellViewModel, binding works.
But what about MyNextView ?   How to bind it to it's MyNextViewModel ?

Thank you very much


Nov 25, 2010 at 3:47 PM

Use the Bind.Model attached property. See the article All about Actions in the docs for info on View-First.

Nov 27, 2010 at 5:37 AM


Thanks for such a wonderful framework. I have a follow up question what is asked by amantha. In the answer you gave asked to use View-First. I am wondering in such similar case can we use ViewModel first approach. If so how to implement the same. I have the same setup as amantha has. Have a ShellView user control and that binding works. Inside the ShellView user control I have two more user controls CustomerView and OrderView. But the child usercontrols binding are not working. After following the example of View-First approach I was able to get it working. But just wondering how ViewModel first approach works for such a case. 

Please ignore my ignorance on CM. I am new to SL and WPF and trying to understand more of MVVM and CM.



Nov 29, 2010 at 9:53 AM

You can use View.Model to inject a view inside a ContentControl (or better, a control having a 'Content' property). That counts as a view-model-first approach.

Nov 30, 2010 at 7:24 PM

Thanks BladeWise. That worked. Thanks for the help